Skip to content

Instantly share code, notes, and snippets.

@halter73
Created June 27, 2013 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halter73/a3ca17f974a0583e6897 to your computer and use it in GitHub Desktop.
Save halter73/a3ca17f974a0583e6897 to your computer and use it in GitHub Desktop.
03:47:21.6339647 - null - ChangeState(Disconnected, Connecting)
03:47:21.9829319 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - LP Connect: http://signalr01.cloudapp.net:81/signalr/connect
03:47:22.0619785 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - LP: OnMessage({"C":"d-F,34E|5,0|6,1|7,0","S":1,"M":[]})
03:47:22.0809818 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - ChangeState(Connecting, Connected)
03:47:22.0830037 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - LP Poll: http://signalr01.cloudapp.net:81/signalr/poll
03:47:23.4891261 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - LP: OnMessage({"C":"d-F,34F|5,0|6,1|7,0","M":[{"H":"demo","M":"fromArbitraryCode","A":["6/27/2013 3:47:24 AM"]}]})
03:47:23.5011884 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - LP Poll: http://signalr01.cloudapp.net:81/signalr/poll
03:47:27.3226777 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - OnMessage({"R":10,"I":"0"})
03:47:28.5017671 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - Timed out waiting forfromArbitraryCode callback
03:47:28.5017671 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - Stop
03:47:28.6427827 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - OnMessage({"R":10,"I":"2"})
03:47:28.7168677 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - LP: OnMessage({"C":"d-F,351|5,0|6,1|7,0","M":[{"H":"demo","M":"fromArbitraryCode","A":["6/27/2013 3:47:26 AM"]},{"H":"demo","M":"fromArbitraryCode","A":["6/27/2013 3:47:28 AM"]}]})
03:47:32.4743157 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - OnMessage({"R":10,"I":"1"})
03:47:58.5036033 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - Abort never fired
03:47:58.5036033 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - Disconnected
03:47:58.5046017 - 2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a - Closed
03:47:58.5046017 - null - Transport.Dispose(2cb0966b-1b5f-472f-99e6-a3dc0ce0d85a)
using System;
using Microsoft.AspNet.SignalR.Client;
using Microsoft.AspNet.SignalR.Client.Hubs;
using Microsoft.AspNet.SignalR.Client.Transports;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
var mre = new ManualResetEventSlim();
using (var hubConnection = new HubConnection("http://signalr01.cloudapp.net:81"))
{
hubConnection.TraceWriter = Console.Out;
var hubProxy = hubConnection.CreateHubProxy("demo");
hubProxy.On("fromArbitraryCode", _ => mre.Set());
hubConnection.Start(new LongPollingTransport()).Wait();
Task.Factory.StartNew(() =>
{
while (true)
{
if (hubConnection.State == ConnectionState.Connected)
{
Task.WaitAll(hubProxy.Invoke("GetValue"), hubProxy.Invoke("GetValue"), hubProxy.Invoke("GetValue"));
//hubProxy.Invoke("GetValue").Wait();
}
}
});
while (true)
{
if (mre.Wait(TimeSpan.FromSeconds(5)))
{
mre.Reset();
}
else
{
hubConnection.Trace(TraceLevels.Events, "Timed out waiting for fromArbitraryCode callback");
break;
}
}
}
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment