Ejemplo n.º 1
0
        protected virtual void OnStreamingMessageRecieved(object sender, RpcStreamingResponseMessageEventArgs args)
        {
            var handler = StreamingMessageReceived;

            if (handler != null)
            {
                handler(this, args);
            }
        }
        private void RpcStreamingMessageResponseHandler(object sender, RpcStreamingResponseMessageEventArgs e)
        {
            if (e.Message.Params.Subscription != this.subscriptionId)
            {
                return;
            }

            // do something with e.Message
            var handler = MessageRecieved;

            if (handler != null)
            {
                try
                {
                    var args = new StreamingEventArgs <T>(e.Message.GetResult <T>());
                    handler(this, args);
                }
                catch (FormatException formatException)
                {
                    throw new RpcResponseFormatException("Invalid format found in RPC streaming response", formatException);
                }
            }
        }