public new Task Start() { Url = websocketuri; MessageReceived.Subscribe((message) => { if (message.Text.StartsWith("2::")) { Send("2::"); } }); return(base.Start()); }
public MessageReceiverEx(AsyncTcpServer asyncTcpServer) { _asyncTcpServer = asyncTcpServer; MessageReceived = Observable.FromEventPattern <MessageReceivedEventArgs>(_asyncTcpServer, "MessageReceived"); Random rnd = new Random(); LogEvents = Observable.Create <string>( o => { return (MessageReceived.Subscribe( data => { string value = Encoding.UTF8.GetString(data.EventArgs.Message.MessageData); Console.WriteLine("Received " + value + " at " + Thread.CurrentThread.ManagedThreadId); o.OnNext(value); })); }); }