Azure SignalR as an Azure Event Grid source
This article provides the properties and schema for SignalR Service events. For an introduction to event schemas, see Azure Event Grid event schema. It also gives you a list of quick starts and tutorials to use Azure SignalR as an event source.
Available event types
SignalR Service emits the following event types:
Event type | Description |
---|---|
Microsoft.SignalRService.ClientConnectionConnected | Raised when a client connection connected. |
Microsoft.SignalRService.ClientConnectionDisconnected | Raised when a client connection disconnected. |
Example event
The following example shows the schema of a client connection connected event:
[{
"source": "/subscriptions/{subscription-id}/resourceGroups/signalr-rg/providers/Microsoft.SignalRService/SignalR/signalr-resource",
"subject": "/hub/chat",
"type": "Microsoft.SignalRService.ClientConnectionConnected",
"time": "2019-06-10T18:41:00.9584103Z",
"id": "831e1650-001e-001b-66ab-eeb76e069631",
"data": {
"timestamp": "2019-06-10T18:41:00.9584103Z",
"hubName": "chat",
"connectionId": "crH0uxVSvP61p5wkFY1x1A",
"userId": "user-eymwyo23"
},
"specversion": "1.0"
}]
The schema for a client connection disconnected event is similar:
[{
"source": "/subscriptions/{subscription-id}/resourceGroups/signalr-rg/providers/Microsoft.SignalRService/SignalR/signalr-resource",
"subject": "/hub/chat",
"type": "Microsoft.SignalRService.ClientConnectionDisconnected",
"time": "2019-06-10T18:41:00.9584103Z",
"id": "831e1650-001e-001b-66ab-eeb76e069631",
"data": {
"timestamp": "2019-06-10T18:41:00.9584103Z",
"hubName": "chat",
"connectionId": "crH0uxVSvP61p5wkFY1x1A",
"userId": "user-eymwyo23",
"errorMessage": "Internal server error."
},
"specversion": "1.0"
}]
Event properties
An event has the following top-level data:
Property | Type | Description |
---|---|---|
source |
string | Full resource path to the event source. This field isn't writeable. Event Grid provides this value. |
subject |
string | Publisher-defined path to the event subject. |
type |
string | One of the registered event types for this event source. |
time |
string | The time the event is generated based on the provider's UTC time. |
id |
string | Unique identifier for the event. |
data |
object | SignalR Service event data. |
specversion |
string | CloudEvents schema specification version. |
The data object has the following properties:
Property | Type | Description |
---|---|---|
timestamp |
string | The time the event is generated based on the provider's UTC time. |
hubName |
string | The hub that the client connection belongs to. |
connectionId |
string | The unique identifier for the client connection. |
userId |
string | The user identifier defined in claim. |
errorMessage |
string | The error that causes the connection disconnected. |
Tutorials and how-tos
Title | Description |
---|---|
React to Azure SignalR Service events by using Event Grid | Overview of integrating Azure SignalR Service with Event Grid. |
How to send Azure SignalR Service events to Event Grid | Shows how to send Azure SignalR Service events to an application through Event Grid. |
Next steps
- For an introduction to Azure Event Grid, see What is Event Grid?
- For more information about creating an Azure Event Grid subscription, see Event Grid subscription schema.