WebSocket Integration with Azure Logic Apps

Harris Kristanto
4 min readOct 20, 2023


I recently learned about a fascinating technology that is commonly used in modern apps, Websocket. Websocket is a fascinating technology that enables real-time, full-duplex communication between a client and a server. Unlike the traditional HTTP protocol, which follows a request-response pattern, it provides a persistent, bidirectional channel for instant data transfer.

This means that with Websocket, both the client and server can send data to each other at any time, making it an ideal choice for applications requiring low latency and real-time updates, think of social feeds/messaging apps and multiplayer games as examples.

In the context of Integration Development, you may come across some systems that only communicate through Websocket, this is where the Azure Web Pubsub steps in to bridge the gap, a fully managed service by Azure that supports native and serverless WebSocket.

Solution Overview

The solution’s requirements are quite simple:

  1. Monitoring Azure SQL database changes.
  2. Publishing change messages via WebSocket.
  3. Adopting a consumption-based pricing model, ensuring costs align with actual usage.

It’s important that we first understand the key concepts in Web PubSub:

1. Hub: A hub is a logical concept for a set of client connections. Usually, you use one hub for one purpose, for example, a chat hub, or a notification hub. When a client connection connects, it connects to a hub, and during its lifetime it belongs to that hub. Once a client connection connects to the hub, the hub exists. Different applications can share one Azure Web PubSub service by using different hub names.

2.User: Connections to Web PubSub can belong to one user. A user might have multiple connections, for example when a single user is connected across multiple devices or multiple browser tabs.

While Azure Logic Apps don’t have a built-in action that supports WebSocket, we can work around this by using Web PubSub’s REST API, and using Entra App Registration (formerly known as Azure AD) for authorization.

Solution Architecture

Let’s look at the breakdown of the solution:

1. Azure SQL Database: An Azure SQL Database instance with change tracking enabled on both database and table level, note that you will also need to have a “rowversion” column for the Logic Apps trigger to work.

2. Azure Web PubSub: For demonstration purposes, a Web PubSub is configured on the Free tier, with a designated Hub named “SQLUsers.”

3. Azure Logic Apps: A logic app triggered by SQL Server Trigger, subscribing to a table in Azure SQL, it obtains Microsoft Entra token for authentication and sends the message to a specific User in the Web PubSub.

Overview of the Logic Apps:

Get JWT Token from Entra
Sends the SQL update payload to Web PubSub

4. The Subscribing Systems: Destination systems or applications that establish WebSocket connections to subscribe to Azure Web PubSub can vary and may include services running on Azure App Service or Azure VM. The systems will need to first obtain an access URL to be able to connect via WebSocket.

Testing the Solution

Let’s see this solution in action.

1.Head over to Azure Web PubSub Service, and select “Quick Try” under the overview tab, this should take you to a test console.

2.Under the “Keys” settings and generate a new access URL that connects to Hub “SQLUsers” as User ID “12345” then copy the “Client Access URL”.

3.Paste the Client Access URL on the test console and click Connect

4.Trigger the logic app by updating a row in SQL, ensure that run is successful and a message is sent to PubSub.

5.Head back to PubSub testing console and ensure that the test message sent by Logic Apps is received in the console.

Hope this post has given you some idea on how to build a low-code solution with Websocket using Logic Apps, it’s worth noting that connecting to Azure Web PubSub can be achieved through its SDK, offering an alternative to calling the PubSub’s REST API.



Harris Kristanto

System Integration and DevOps specialist working in the cloud with Microsoft Azure and Dell Boomi.