Can SignalR be used to update clients which are servers by itself? - asp.net-web-api

I'm trying to implement a Server which is a Asp.Net WebApi. This server is accessed by so many child services(let it be web servers). Can SignalR be used to update these child servers so that the child servers can update all the clients attached to them?

SignalR is a Server <> Client technology, it can be used Server <> Server but its better to use a Service bus like nServicebus or MQ to pub / sub between services.
edit: If its for scalability only you can use SignalR scaleout features

Related

API Server as SignalR client

I've got an ASP.NET MVC Core application which is served from a web server. The web server has a SignalR Hub and gets its data from a dedicated API server. Is it possible to register the web clients AND the API server as SignalR clients, so that the API server can push data directly to the web clients?
Yes. From the same host, inject a IHubContext<YourHub> into your controller classes and from there you can send messages to any connected clients, see more here: https://learn.microsoft.com/en-us/aspnet/core/signalr/hubcontext.
From a different host, use the SignalR client, see here: https://learn.microsoft.com/en-us/aspnet/core/signalr/dotnet-client.

Enable signalr to accept WS connections

I have created a dotnet core signalr project, and I want to allow other users to connect on the signalr web socket like I can do it when I connect on:
wss://echo.websocket.org
Currently, signalr generates ID when creating the negotiation, and when switching on wss it uses that id, but it is causing a problem when using external connections.
So, is it possible to tell SignalR not to generate the id when creating the websocket server, and also to accept external ws connections ?
try to use dotnet core websockets
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/websockets?view=aspnetcore-2.2

Does each SignalR hub has a dedicated websocket

Assuming both browser & Server supports a web-socket connection.
If I've got 2 hubs on my SignalR server. and my SignalR client connects to both. does that mean that my signalR client will open up 2 separate web-socket connections to the server?
In SignalR v2+, hubs will share the same connection. I've had systems with connections to 4+ hubs without performance issue.
Question is a bit of a duplicate of: Multiple signalR connections/hubs on your website

One Web API calls the other Web APIs

I have 3 Web API Servers which have the same functionality. I am going to add another Web API server which will be used only for Proxy. So All clients from anywhere and any devices will call Web API Proxy server and the Proxy server will transfer randomly the client requests to the other 3 Web API servers.
I am doing this way because:
There are a lot of client requests in a minute and I can not use only 1 Web API server.
If one server was dead, clients can still send request to the other servers. (I need at least 1 web servers response to the clients )
The Question is:
What is the best way to implement the Web API Proxy server?
Is there a better way to handle high volume client requests?
I need at least 1 web server response to the clients. If I have 3 servers and 2 of them are dead.
Please give me some links or documents that can help me.
Thanks
Sounds like you need a reverse proxy. Apache HTTP Server and NGINX can be configured to act as a load balanced reverse proxy.
NGINX documentation: http://nginx.com/resources/admin-guide/reverse-proxy/
Apache HTTP Server documentation: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
What you are describing is call Load Balancing and Azure (which seems you are using from your comments) provides it out of the box both for Cloud Services and Websites. You should create as many instances as you like under the same cloud service and open a specific port (which will be load balanced) under cloud service endpoints.

Asynchronous messaging (ActiveMQ, MSMQ) to ASP application (MVC3)

I have been reading articles about asynchronous messaging between clients using MVC3 and the SignalR library (http://sergiotapia.com/2011/09/signalr-with-mvc3-chat-app-build-asynchronous-real-time-persistant-connection-websites/)
We currently use activemq for some of our fat client apps and use topics to broadcast data to everyone. Does anyone know if this sort of thing could be used in MVC3 as well?
I'd like to create an application that doesn't require a user to install anything (and could even be used on a phone), but it would be monitoring continuously-changing data. We're talking refreshing data every 2-3 seconds.
If you want to have asynchronous messaging with client (browser) use SignalR. ActiveMQ and MSMQ are technologies for thick clients and server-to-server communication. They require installation (MSMQ requires windows installation) and they are not accessible from browser (well I can imagine accessing MSMQ through ActiveX or ActiveMQ from Java applet but that is not what you are looking for).
One of the possible ways to go is to build a web service which will implement communication with AMQ/MSMQ via their APIs and do poll this web service from your webpage (via ajax call for example) to refresh the data as it's needed.

Resources