1
votes

I would like to connect to the Chat Hub (code from Scott's chat example) using SignalR .Net Client but not sure how to do it correctly.

I have used the following code but it fails to connect. After calling connection.Start(), no connection Id is returned.

var connection = new HubConnection("http://localhost:1065/");

var myHub = connection.CreateProxy("Mvc3SignalR.Models.Chat");

connection.Start();

Link to Scott's chat example http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx

2

2 Answers

1
votes

I assume that when you say "returns the connection id", you are talking about that the response shown in the profiler comes back as the page HTML without the JSON tab (I'm using firebug).

I had the same issue with my application and it turns out because the browser my friends were using doesn't have a JSON parser. Simply including json2 from nuget solved my problem. Hope this helps because I think wait() is a bit odd for a solution.

0
votes

There was a bug in the 0.4 client where failing connections would never return (it would hang forever). I'm not sure if this is what you're experiencing but you should update to the latest signalr.client package. Also, Start is async so I'm not sure what you mean by "returns the connection id".