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); }
private void OnPacketReceived(SimpleClient sender, ByteStream packetStream) { MyRpcRequest req = new MyRpcRequest(); req.MergeFrom(new CodedInputStream(packetStream)); MyServiceDefinition service; if (m_Services.TryGetValue(req.ServiceId, out service)) { service.OnRequestReceived(sender, req); } }
private void OnPacketReceived(SimpleClient sender, ByteStream packetStream) { MyRpcRequest req = new MyRpcRequest(); req.MergeFrom(packetStream); MyRequestHandler pending; if (m_PendingRequests.TryGetValue(req.RequestId, out pending)) { pending.OnResponse(req); if (pending.Concluido) { m_PendingRequests.Remove(req.RequestId); } } }
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); } } }
public virtual void OnResponse(MyRpcRequest request) { throw new NotImplementedException(); }