SignalR 2 & Javascript Client to Server A to Server B

220 views Asked by At

I have the following architecture setup.

Client A (Javascript) => Server A (Has SignalR Server) and Client A (Javascript) => Server B (Also has SignalR Server)

I want to know if i can make it like so.. Client A => Server A => Server B

Where Client A can connect signalr on ServerA, and using rewrite rules, also allow connections to another URI like /backend/signalr to go through to Server B ?

The reason behind this architecture is because i have a front-end that serves a site amongst other things, but a back-end processing application that also requires feedback to the client (Server B to Client A). I currently use SignalR on both Servers, and the client can connect directly to both.

The reason to this question is that i would like to remove the back-end server from being public facing and allow only internal network requests, that's fine and doable, but the only problem i have to manage is the client's feedback updates from Server B to Client A, which would have to typically route through Server A.

I saw a answer here @ SignalR with IIS 10 and ARR 3.0 , which actually had a similar issue, except that it didn't have the first proxy server serving SignalR aswell.

I guess this is a additional different case as that it has 2 SignalR implementations in the architecture.

Another thought it that perhaps this could be done by using web.config and IP Restrictions on the Server B allowing only direct communication from Server A, and URI's with SignalR to allow public facing - but i prefer to remove that entirely if possible.

Our application uses ASP.NET 4.6 IIS 10

1

There are 1 answers

0
Jeffrey Holmes On BEST ANSWER

I solved this eventually and thus removed the backend server from receiving requests from the client browser directly.

I created a 'proxy' that sat in the Server A Hub definition class that when a requirement to the backend server was required, i would create a C# client that then connects to the internal servers. Created the needed methods that the Backend Server would then emit / send via SignalR to the FrontEnd server, and then pushed to the Client Javascript browser.

I think that Application Routing Requests feature in IIS, since it doesn't support HTTPS, this implementation gets the job done.

If there is any other implementation or thoughts about this, I'd love to know what others think. It did get the job done for me in the end and I can now remove the backend server from being public facing due to the SignalR requirement that i initially had.