I'm trying to get a basic sample across domains working, but I just cannot get it to work. According to someone here https://github.com/SignalR/SignalR/issues/6 he got it to work by adding a Access-Control-Allow-Origin
header.
Basically, I've added a hub to an mvc 3 application, added the above header in the web.config, and created a page to send a message. This setup works fine. Next, I've created a different web application using the same client javascript on a page, but setting the url to a different server using:
$.connection.hub.url = 'http://www.myserver.com/signalr';
As soon as I use a remote url it stops working.
How can I get SignalR to work across domains?
Update: Some added information, the above approach works for chrome and firefox, but IE9 is not liking it...
I got it working using a simple test project and Internet Explorer 9, but it wasn't easy and first I was hung on the same problems you described. I think you are almost there and you are only missing the following line in your JavaScript:
jQuery.support.cors = true;
which tells jQuery to do cross domain calls. Seems simple, but was really hard to find ;-)
I explained all the steps I did in a blog post since I didn't find any existing information on this topic so far.
Tell me if there are any more problems. I have a working test project running in Internet Explorer 9 which I can send you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With