An Overview of WebSocket and Hub in SignalR

What is SignalR

SignalR is a library for .NET to help build real-time, multi-user web applications. It is not necessary for it to be hosted in ASP.NET, it can also be hosted using Open Web Interface for .NET (OWIN) or be self-hosted. So real-time web functionality is the ability to push the content of a server to connected clients.

In the HTTP model (request and response model) each time we have a need to send a new request for the communication with the server but SignalR provides a persistent connection between the client and server both. SignalR sends data in plain text so if you want to send data in the compressed format then you need to write your own logic on the client and server, both sides. SignalR provides two types of functionality that I would like to introduce in this article.


WebSocket is a protocol for full-duplex communication via the HTTP protocol. It is always an open Transaction Control Protocol (TCP) connection between the server and client. The client can send data to the server and the server can return data back to the client over the same channel at any time. Note that not all the browsers support web sockets. The following table shows all the browsers that support WebSocket.

Need Of WebSockets

WebSocket enables the server to push the data to the already connected clients. The following are some examples of an application where a WebSocket would be useful.

  • Chat Application
  • Multi-player Games
  • A stoke market apps
As you know that the request-response process describes a synchronous communication. The client asks the server for a resource, the server measures some CPU tasks while the client patiently waits, then the server responds back with the requested resource. That's why a WebSocket provides bidirectional communication.

The procedure to check your web apps locally on your PC is to first click on search and type IIS, if you are not finding this then you need to enable it first.

Go to Control Panel and search program and then click on Turn Window features on or off, then you find Internet Information Services and then World Wide Web services. You will now see the Web socket protocol. Also have the web socket features.

Advantages of using WebSockets

WebSocket is a new component tool for web developers, here are six major advantages of the use of WebSockets.

  • Deliver full duplex communication Model for web
  • Increased client and server efficiency
  • Easy to use
  • Open full duplex connection over the web.
  • Faster than HTTP
  • Replacement of HTTP, Uses TCP
Disadvantages of using WebSockets
  • Browser must be fully HTML5 complaint
  • Takes over the communication protocol between client and server for a specific connection.
Websockets promote app development simplicity and efficiency by saving time, saving money and saving space.


In the networking terms a Hub is a networking device allowing multiple clients to share an Ethernet connection. Now that concept makes it easy to understand SignalR Hub functionality. A Hub provides multicast functionality over a WebSocket connection. When any one of the clients send a message to the Hub it broadcasts the message to all the connected clients and makes a connection between them called a Client-Hub Connection.


This article described what you can do with WebSockets and SignalR Hub. Thanks for reading this article.