This project is read-only.

Connect to a different domain

Topics: Developer Forum
Jan 11, 2014 at 5:33 PM

I have upload the chat on my server and it's work great on the same domain.

But if I put chat.html file on another domain (with the js files point on the first domain)
The chat is always offline. How I can connect the chat in different domains?

It's possible?

Thank you
Jan 30, 2014 at 10:43 AM
In javascript requests should be made to the same domain by default.

You can enable Cross-Domain requests in the SignalR Startup file /LCSK/Startup.cs i.e.

app.Map("/signalr", map =>
map.RunSignalR(new HubConfiguration { EnableJSONP = true });

You might have to add this to your web.config:

  <add name="Access-Control-Allow-Origin" value="*" />

And you might enable it also on the client. Depending on your infrastructure CORS might not be available, SignalR will fail back to JSONP, but you might not enable CORS if it's not available, otherwise SignalR will not use JSONP.

Do a search for SignalR and cross-domain requests that should help.

Good luck,