Esempio n. 1
0
            protected override Task OnMessageReceivedAsync(IWebSocketContext context, byte[] buffer, IWebSocketReceiveResult result)
            {
                if (this.eventCallback != null)
                {
                    var data    = Encoding.GetString(buffer);
                    var message = WebMessage.Parse(data);

                    var gm = new GlobalMessage()
                    {
                        From = message.from,
                        To   = message.to,
                        Type = Enum.Parse <GlobalMessageType>(message.type, true),
                        Data = message.data,
                    };
                    this.eventCallback(gm);
                }
                return(Task.Run(() =>
                {
                }));
            }