On our journey toward Blazor, we look at one of the technologies called SignalR used by the Blazor server side.

SignalR is used by the ASP.Net framework to enable real-time data transfer in web applications between the server and client.

So to start, let’s explain the traditional HTTP communication method between the server and the client.

With web applications, we always have two sides, the client-side and the server-side.

Think of the server and client as two islands separated by a river. The river disconnects the server island and client island from each other. So how do you cross a river? You use a boat, let’s call the boat HTTP.

SignalR

 

So a request climbs into the boat from the client-side and crosses the river to the server-side. The request fetches what it needs from the server and then crosses back to the client-side with the response it needs and then displays it on the screen. So you only have data going in one direction each time, because, there is only one boat.

SignalR

 

SignalR builds a bridge between the Server island and client island creating a permanent connection for the duration of the session. This enables data to flow bi-directional. So now the server-side can push data to the client in real-time, and the client can update data in real-time on the server-side.

 

SignalR

 

SignalR builds a bridge between the Server island and client island creating a permanent connection for the duration of the session. This enables data to flow bi-directional. So now the server-side can push data to the client in real-time, and the client can update data in real-time on the server-side.

So what does SignalR use to build the bridge? SignalR uses one of the following 4x technologies to create the connection:

1. WebSockets
2. Event Source
3. Forever Frame
4. Ling Polling

WebSockets, Event Source, and Forever Frames are known as Real-Time connection frameworks, and Long Polling is a simulated real-time framework. SignalR will start at WebSockets and work its way down the list until it finds a framework that will work with the given network environment.

Starts at top and tries each one until it gets ine that works

Why use SignalR?

SignalR encapsulates all of the real-time connection frameworks for you allowing you to concentrate more on the rest of your application. Think of it as just using the bridge to cross the river, you don’t have to deal with engineering and building the bridge from the ground up.

If any of the underlying technologies become obsolete and replaced by another technology, SignalR will automatically manage that for you.

SignalR can also be used in a wide range of technologies from mobile applications to desktop apps.