Clone this wiki locally
Frequently Asked Questions
Why doesn't SignalR work in browser IE?
SignalR requires a JSON parser and ability to send xhr requests (for long polling). If your browser has none, you'll need to include json2.js in your application (SignalR will throw an error telling your you need it as well). You can get it on NuGet.
Also check that the document mode in the IE browser tools isn't set to IE7. You can force IE to use the latest by adding this to your webpage:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Why does signalr/hubs return 404 or Why do I get 'myhub' is undefined?
First, make sure you have a call to MapHubs() in Global.asax.
Please make sure that the Hub route is registered before any other routes in your application.
In ASP.NET MVC 4 you can do the following:
If you're writing an MVC 3 application, make sure that you are using
Url.Content for your script references:
If you're writing a regular ASP.NET application use
ResolveClientUrl for your script references:
If the above still doesn't work, make sure you have RAMMFAR set in your web.config:
<configuration> <system.webServer> <modules runAllManagedModulesForAllRequests="true"> </modules> </system.webServer> </configuration>
Why isn't my client side method getting called?
You can turn logging on client side to see all incoming calls from server to client.
$.connection.hub.logging = true; $.connection.hub.start();
To see the generated logs, open the console window in the browser tools.
Why do I get an exception saying "Unknown Transport" on the server side?
Make sure you're using the latest version of the signalr client (js or .net client).
Why do I see the error "Connection must be started before data can be sent. Call .start() before .send()"?
There can be a couple of reasons for this. The first thing to recognize is that connection.start() is async. To do work after connection.start() (or $.connection.hub.start() if using hubs), specify a callback or use the jQuery deferred object returned to do work directly after start.
See https://github.com/SignalR/SignalR/wiki/SignalR-JS-Client for more details.
If this isn't the problem, there was probably an error during negotiation. To get more information about the exception, view the raw response in your browser tools or fiddler.
Why does SignalR stop accepting connections after ~10 or so?
If you are doing development with full IIS on Windows 7, there's a built in limitation of 10 concurrent connections. You need to use IIS Express or Windows Server.
Server side methods can be called, but client side methods cannot
Why don't I see disconnect notifications?
If you're running the built in visual studio development server, disconnect will never fire (there's a bug in the server implementation that prevents it from working). Use IIS Express or full IIS.
Why do I see a 301/302 then 403/404 sometimes?
Do you have a folder in your project called signalR at the root? If yes, rename it so something else. The common convention for naming the folder with Hub classes is calling that folder
How do I get a list of clients/connections?
When using jQuery Mobile OnConnected gets called twice
What transports does SignalR use in various browsers to mimic a real-time connection?
SignalR uses a fallback mechanism to connect the browser to the server. After an initial negotiation request the following transports are tried in order until a successful connection can be made:
- WebSockets (if the both the server and browser indicate they can support websockets)
- Server Sent Events, aka EventSource (if the browser supports Server Sent Events, which is basically all browsers except Internet Explorer)
- Forever Frame (for Internet Explorer only)
- Ajax long polling
WebSockets is the only true full-duplex connection transport. All other transports listed here use the technique/technology named for the incoming data from the server, and standard Ajax POSTs for sends from the client to the server.
SignalR SelfHost upgrade from 1.1.x to 2.0.0
Your project fails to build with this error:
The call is ambiguous between the following methods or properties: 'Owin.OwinExtensions.MapConnection<T>(Owin.IAppBuilder, string, Microsoft.AspNet.SignalR.ConnectionConfiguration)' and 'Owin.OwinExtensions.MapConnection<T>(Owin.IAppBuilder, string, Microsoft.AspNet.SignalR.ConnectionConfiguration)'
The reason is "Microsoft.AspNet.SignalR.Owin" has been deprecated. You must uninstall the NuGet Package from your project.