SignalR server to server communications - .net-core

I have an application that uses SignalR to broadcast data to all connected clients. Its a .NET6 Blazor Wasm hosted web application. Now, I want the the broadcaster (which is running on the Blazor server) to connect to a data source that is outside my website, and get data from there. The source data is being broadcast via UDP on a different network.
So my question is, is it possible that my SignalR hub that is running on the Blazor server connects to another SignalR hub running on a different machine in a different network and get real time data from it? Or may be I can run a SignalR client as well on my Blazor server and then connect to a machine on another network? Can I run a SignalR hub on the UDP source machine to which my Blazor server SignalR hub or client can connect? From what I have read, SignalR only runs on a website. Or is it that SignalR is not suitable for this kind of server to server data feeds?

Related

How can i host signalr on a dedicated server

I am working on a blazor application.
I have tried azure signalr services (ASRS).
All signalr requests are handled by a dedicated azure resource. So it suppose this reduce load on web server.
What i want to do is to deploy a dedicated signalr server like ASRS but on my own bare-metal server.
I have read some documentation about self-hosted azure but this is not the same thing than ASRS because ASRS does not host Hubs. Hubs stays on web server.
How can i do this ?
Thanks

Own IOT platform using websockets

I am doing an IOT platform for my final year project at university, the concept is to link an IoT device with the Platform using WebSockets. My Websocket is working very well and I can send message from server to client.
But I don't know how to connect two clients to send messages to others via websocket server.
I can send message between website and server and also between my esp8266 and server.
how can I connect my arduino to the website?
Thank you
A WebSocket is basically a persistent connection between a client and
server.
In order for devices to talk with each other they first need to pass
by the server.
The server simply redirects the messages to the client that needs to
receive it.
Generally you'd have the WebSocket server in your backend.
Your frontend will be a WebSocket client.
Your device will be another WebSocket client.

SignalR connection pooling

I have 2 separate ASP.Net sites, one is outward facing serving the UI and the other is a backend API that is only ever accessed by the UI server.
We are using SignalR to push events through the client but these events originate on the backend API so there is a SignalR connection from browser -> UI Server and another from UI Server -> Backend API.
Currently each client that connects SignalR from the browser causing a new connection to be made to the backend API. This means that we have a lot of connections for the same hubs through between the same processes.
Is there any way in SignalR to have it pool the connections so they use the same underlying sockets while hiding that abstraction from my code in the SignalR .Net Client?

When we should use SignalR self hosted and when we should not?

I am in a stage of using SignalR in my project and i don't understand when to use Self hosted option and when we should not use. As a example if I am willing to host my web application in server farm,
There will be separate hosting servers
Separate SignalR hubs in each IIS server
If we want to broadcast message into each client, how this is working in SignalR
The idea with SignalR running in multiple instances is that clients connected on instance A cannot get messages from clients connected to instance B.
(SignalR scaleout documentation)
However, when you scale out, clients can get routed to different
servers. A client that is connected to one server will not receive
messages sent from another server.
The solution to this is using a backplane - everytime a server recieves a message, it forwards it to all other servers. You can do this using Azure Service Bus, Redis or SQL.
The way I see, you use the self host option when you either don't want the full IIS running (because you have some lightweight operations that don't require all IIS heaviness) or you don't want a web server at all (for example you want to add real-time functionality to an already existing let's say forms application, or in any other process).
Be sure to read the documentation for self-hosting SignalR and decide whether you actually need to self host SignalR.
If you are developing a web application under IIS, I don't see any reason why you would want to self-host SignalR.
Hope this helps. Best of luck!

How can I use SignalR Hubs / Proxies without SignalR connection?

Here is my situation:
I have a 4-tier web application consisting of browser, web server, application servers and database.
Browser and application server should communicate in a RPC-style way.
The backend will run on windows machines, so I will use IIS as web server The application needs real time communication between application server and browser.
I want to use a SignalR connection for the communication between browser and web server. For the communication between web server and application server's I want to use a plain TCP connection.
I think this approach will enable me to send JSON messages between browser and application servers. But how can I realize a RPC communication?
Can I write a SignalR Hub, generate a JS proxy and bind the Hub to a TCP socket?
Here is a picture: https://www.dropbox.com/s/xeaja4dos4bgvbz/SignalR_Hubs_Stackoverflow.png
Nope. SignalR is based on HTTP not TCP directly. WebSockets is the closest thing to a raw tcp socket and it has the added benefit that it works over port 80.

Resources