Exemple #1
0
        protected void Send(MyMethodDefinition method, IMessage message)
        {
            MyRpcRequest req = new MyRpcRequest();

            req.RequestId   = 0;
            req.MethodId    = method.MethodId;
            req.ServiceId   = this.ServiceId;
            req.PayloadData = message.ToByteString();
            m_Canal.Send(req);
        }
        public void OnRequestReceived(SimpleClient sender, MyRpcRequest req)
        {
            MyMethodDefinition method;

            if (m_Methods.TryGetValue(req.MethodId, out method))
            {
                IMessage result = method.OnRequest(req.PayloadData);
                if (result != null)
                {
                    MyRpcRequest response = new MyRpcRequest();
                    response.ServiceId   = req.ServiceId;
                    response.MethodId    = req.MethodId;
                    response.RequestId   = req.RequestId;
                    response.PayloadData = result.ToByteString();

                    sender.Send(response);
                }
            }
        }
Exemple #3
0
 public virtual void Send(IMessage request)
 {
     m_Cliente.Send(request);
 }