Пример #1
0
        protected override void OnMessage(MessageEventArgs e)
        {
            var req      = (ChaosInvocation)_binarySerializer.Deserialize(typeof(ChaosInvocation), e.RawData);
            var resp     = _chaosService.ProcessInvocation(req);
            var respData = _binarySerializer.Serialize(resp);

            Send(respData);
        }
        public override Task <AnyProto> SendInvocation(
            AnyProto request,
            ServerCallContext context)
        {
            var chaosInvocation = request.ConvertTo <ChaosInvocation>();
            var invocationReply = _chaosService.ProcessInvocation(chaosInvocation);
            var reply           = invocationReply.ToAnyProto();

            return(Task.FromResult(reply));
        }
Пример #3
0
        void MessageReceived(IWebSocketConnection webSocketConnection)
        {
            webSocketConnection.OnBinary = data =>
            {
                var req = (ChaosInvocation)_binarySerializer.Deserialize(typeof(ChaosInvocation), data);

                var resp = _chaosService.ProcessInvocation(req);

                var respData = _binarySerializer.Serialize(resp);

                webSocketConnection.Send(respData);
            };
        }