Accelerate a real time messaging and communication with Azure Web PubSub (AWPS)
By: Debjyoti Rakshit
Tags: Cloud, Azure, Pub Sub, Messaging, Awps

Publisher and subscriber patterns are one of most vital requirements for any loosely coupled architecture. With the rise in the cases of COVID-19, Technology of every industry is becoming more responsive and active with real time application scenarios like chat, streaming, remotely collaboration, real time dashboard, real time location based tracking and many more. Azure recently released a fully managed service — Azure Web PubSub which connects many clients over WebSocket connections without polling the messages. It also supports auto-scale, load balancing, large-scale client connections, and smooth integration between different platforms without focusing on infrastructure.

Azure Web PubSub Basic Concepts

Azure Web PubSub Workflow

Connections — Represent an individual WebSocket connection connected to Web PubSub service.

Hub -Logical concepts for a set of connections. Broadcasted messages are dispatched to a Hub.

Group - Allow broadcasted messages to a subset of connections to the hub.

Message - Client can send messages to the upstream application, or receive messages from the upstream application, through the WebSocket connection.

Events - Events(Connect, Connected, Message, Disconnected) are created during lifecycle of a client connection.

Event Handler - Configure the client events into service through portal or Azure CLI.

Server - Manage client connections, Handle client events and publish messages.

Azure Web PubSub in real life

There are many real time scenarios where Azure Web PubSub will be useful.

High frequency data updates: gaming, voting, polling, auction.

Live dashboards and monitoring: company dashboard, financial market data, instant sales update, multi-player game leader board, and IoT monitoring.

Cross-platform live chat: live chat room, chat bot, on-line customer support, real-time shopping assistant, messenger, in-game chat, and so on.

Real-time location on map: logistic tracking, delivery status tracking, transportation status updates, GPS apps.

Real-time targeted ads: personalized real-time push ads and offers, interactive ads.

Collaborative apps: coauthoring, whiteboard apps and team meeting software.

Push instant notifications: social network, email, game, travel alert.

Real-time broadcasting: live audio/video broadcasting, live captioning, translating, events/news broadcasting.

IoT and connected devices: real-time IoT metrics, remote control, real-time status, and location tracking.

Automation: real-time trigger from upstream events.

Security

The Azure Active Directory support: It helps the customers to protect and govern the access with a single sign-on and also simplifies the access to applications from anywhere. Private endpoints support: This allows the clients to safely access the Azure Web PubSub services in a virtual network. Secure Outbound traffic: through outbound private end point connections however outbound method have the below pre-requisites.

a. The upstream must be Azure Web App or Azure Function.

b. The Azure Web PubSub service must be on the Standard tier.

c. The Azure Web App or Azure Function must be on certain SKUs.

Price

The billing model for AWPS service is based on the number of units and the size of outbound traffic (message count).

No. of Units = ((x+6) units * 8 hours + x units * (24–8) hours) / 24 hours = (x+2) Unit/Day

Assuming AWPS service instance scale up to x+6 units in business hours and then scale back to x units in non-business hours.

Message Count = Outbound traffic / 2

Outbound Traffic =upstream traffic + Broadcasted data * no. of connections

Sample Demo Link

Whiteboard

Chat

Code Streaming

More Resource

AWPS is not the best fit if you are looking

RPC (Remote Procedure Calls), streaming, and more

2. Automatic reconnect and out of the box management task

3. Server-sent events, and long polling fallback, in case the WebSockets connection fails

Summary

AWPS is a real time pub-sub messaging service for web application development through native and serverless WebSocket support. You can also use this service with variety of programming languages supporting WebSocket APIs.