Example #1
0
        void LogDataReceived(object sender, BayeuxConnectionEventArgs e)
        {
            IJSonWriter output = new JSonWriter(true);
            output.Write(e.Message);

            Console.WriteLine("Response: {0}", output);
            Console.WriteLine();
        }
Example #2
0
        void LogChatEventReceived(object sender, BayeuxConnectionEventArgs e)
        {
            string channel = e.Message["channel"].StringValue;

            if (channel == "/chat/demo" && e.Message.Contains("data"))
            {
                Console.WriteLine("Chat message: {0} said: {1}", e.Message["data"]["user"].StringValue, e.Message["data"]["chat"].StringValue);
            }

            if (channel == "/chat/members" && e.Message.Contains("data"))
            {
                Console.WriteLine("Chat members:");
                foreach (var member in e.Message["data"].ArrayItems)
                {
                    Console.WriteLine(" - {0}", member.StringValue);
                }
            }
        }
Example #3
0
 void LogConnectionFailed(object sender, BayeuxConnectionEventArgs e)
 {
     Console.WriteLine("HTTP status: {0} ({1})", e.StatusCode, e.StatusDescription);
     Console.WriteLine("Exception: {0}", e.Exception);
 }
Example #4
0
 void ConnectionFailed(object sender, BayeuxConnectionEventArgs e)
 {
     waiter.Signal(false);
 }
Example #5
0
 void DataReceived(object sender, BayeuxConnectionEventArgs e)
 {
     waiter.Signal(true);
 }
 /// <summary>
 /// Helper method to fire DataFailed event.
 /// </summary>
 protected virtual void OnDataFailed(BayeuxConnectionEventArgs e)
 {
     Event.Invoke(DataFailed, this, e);
 }
 /// <summary>
 /// Helper method to fire ResponseReceived event.
 /// </summary>
 protected virtual void OnResponseReceived(BayeuxConnectionEventArgs e)
 {
     Event.Invoke(ResponseReceived, this, e);
 }
 private void ConnectionOnResponseReceived(object sender, BayeuxConnectionEventArgs bayeuxConnectionEventArgs)
 {
     var serverMessages = JArray.Parse(bayeuxConnectionEventArgs.Data);
     foreach (var message in serverMessages) {
         ProcessMessage((JObject)message);
     }
 }
 private void ConnectionOnDisconnected(object sender, BayeuxConnectionEventArgs bayeuxConnectionEventArgs)
 {
     OnDisconnected();
 }
 private void ConnectionOnConnectionFailed(object sender, BayeuxConnectionEventArgs bayeuxConnectionEventArgs)
 {
     OnConnectTimeout();
 }
 /// <summary>
 /// Helper method to fire ResponseReceived event.
 /// </summary>
 protected virtual void OnResponseReceived(BayeuxConnectionEventArgs e)
 {
     Event.Invoke(ResponseReceived, this, e);
 }
 /// <summary>
 /// Helper method to fire DataFailed event.
 /// </summary>
 protected virtual void OnDataFailed(BayeuxConnectionEventArgs e)
 {
     Event.Invoke(DataFailed, this, e);
 }