22. Other example – finance
update
• Finance app, currently polling a
backend for stock info, that someone
inserts at regular intervals
• Can we make it SignalR?
Inserts data
Polls for updates
23. Finance app, signalR version
• Serverless app, triggers on inserts
• When insert happens, send SignalR
message to client
Insert happened
Send signalR message
UI updated
Database insert trigger
24. Billing
• Pricing tiers
• Standard
• Free
• Check calculator for
region and currency,
https://azure.microsoft.com/en-
gb/pricing/details/signalr-service/
• When am I being billed?
• Outbound messages only
• Ping messages are ignored
Adds real-time web functionality over HTTP
Azure SignalR Service simplifies the process of adding real-time web functionality to applications over HTTP.
This real-time functionality allows the service to push content updates to connected clients,
such as a single page web or
mobile application. As a result,
Result, updated clients, not using polling
clients are updated without the need to poll the server, or submit new HTTP requests for updates.
Negotiate with service -> get connection The handshake
When the client first connects, it hits a backend route.
That backend route in turn asks the Azure SignalR resource for a connection.
An Azure SignalR connection object Is then returned to the client.
The client can now use the SignalR connection object in all future communications
Listen/Send messages
After the initial handshake, on of two things can take place, sending or receiving messages
Listen, as part of initializing the Azure connection, the client also sets up a callback to listen for incoming messages.
The client decides what event names to listen to like for example “MessageSent”, “IncomingData”, these are names the developer chooses.
Send messages
The client can at any point choose to send a message by for example a user-initiated action, clicking a button for example. To send a message, the client sends a request to the backend.
The backend in turn, communicates the message and raises an event. The Azure SignalR instance then ensures to “broadcast” the message to listening clients.
High frequency data updates: gaming, voting, polling, auction.
Dashboards and monitoring: company dashboard, financial market data, instant sales update, multi-player game leader board, and IoT monitoring.
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 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.
There are 3 different architectures to choose from when implementing Azure Signalr
ASP .NET, using it’s own approach involving a Hub, (a server)
Serverless, the idea is to have an Azure Function as backend
/negotiate
/sendMessage
REST API, you can use the REST API and implement using any runtime that supports HTTP primitives
There are different architectures you can choose to implement Azure SignalR
One such architecture is using Azure Functions. It consists of the following parts:
N number of clients
An Azure Function app consisting of two or more routes
/negotiate, there needs to be a 1 /negotiate route
N number of routes that takes incoming client messages with capability of routing messages and returning response to clients
In this demo, we will give an application realtime capabilities using Azure Signalr
The solution will consist of the following:
An provisioned Azure SignalR instance
An Azure Function app working as a proxy between the client and the Azure SignalR instance
A web client
Standard
1,000 connections,
1,000,000 messages per day included
Estimate unit cost 29.08 USD per month, 0.59 USD per 1,000,000 additional messages
Free
20 connectionz
20 000 messages per unit per day
No additional messages
When am I billed
Outbound only
Assuming that every message is at most 2kb. If it’s bigger it’s divided up. For example, a 4k message is divided up and billed as two messages
Outbound = service to client
Client to client = inbound
Client to server = inbound
1 client sends messag, 4 kb in size to 3 clients and an app server = message count 8.. You are billed for 8 outbound messages
There’s more to this, but it gives you an idea. I’ll post a doc page in the summary if you are interested in this part https://docs.microsoft.com/en-us/azure/azure-signalr/signalr-concept-messages-and-connections