Establishing a cross-domain connection
So far across this book, we've mostly been looking at web scenarios, where web browsers connect to web servers. Moreover, we saw that .NET clients are also used, thanks to the SignalR .NET client library, and we have shown how to perform self-hosting of a SignalR server inside a .NET process. In all these cases, we've always been working in scenarios where the channel between the client and server was established in optimal conditions. On one hand, a .NET client does not have any particular problem in connecting to any type of server, whereas all our examples using web browsers as clients have always been written as simple and self-contained web applications, implying that the asynchronous requests performed by the client code were always going towards the same endpoint from where the client itself was downloaded. This is the most common same-origin scenario, but there might be other scenarios where the client code does not come from the same origin...