Build Serverless Application with Azure SignalR

Build Serverless App

What is Azure SignalR Service?

The Azure SignalR Service is a serverless offering from Microsoft to facilitate real-time communications without having to manage the infrastructure yourself. Azure SignalR Service provides a process of giving real-time web functionality (i.e. push updates to connected clients) to applications over HTTP protocol. The client gets updates without poll to the server (which means without refreshing the web page – here server push to a client as and when needed)

Benefits of using Azure SignalR Function:

  • Integrating Azure SignalR Service with an ASP.NET Core SignalR application helps to scale out for large connections.
  • Azure SignalR Service accepts many languages such as JavaScript, C#, and Java.
  • Azure signal is used in client inrerfaces like browser, desktop, mobiles, games etc .
Generally, WebSocket is the optimal transport that is used, but, if a WebSocket connection cannot be established, the SignalR client will fall back to either Server-Sent Events or long polling.

How to Use Azure SignalR Service with Azure function?

  1. Create Azure SignalR Service from azure: 
Create SignalR service from Azure

2. Copy the connection string of azure SignalR(to be used for configuration)

  • local.settings.json : Add connection string of signalR from Azure into local.settings,json

“AzureSignalRConnectionString”: “{Azure Signal R connection }”

  • Packages installation:


3. Creating The Azure Functions with the SignalR Bindings :The first SignalR-related function is the function that a client calls to get itself wired-up to the the SignalR service in the cloud
This function will be automatically called from the SignalR client code as we’ll see later in this article.
Now the client can negotiate a connection to the Azure SignalR Service via our Function App.
The preceding function is triggered from the queue (“new-order-notifications”) that the initial HTTP function wrote to, but you can send SignalR messages from any triggered function.

4. Creating client interface: Now that we have an endpoint that the client can call to retrieve the information through SignalR Services.



Follow Us on Social Media