You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-web-pubsub/includes/reference-permission.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ ms.date: 08/06/2021
8
8
9
9
## Permissions
10
10
11
-
A Web PubSub WebSocket client can only publish to other clients when it's authorized to. The `roles` assigned to the client determine the initial permissions granted to the client:
11
+
A Web PubSub WebSocket client can only publish to other clients when it's authorized. The `roles` assigned to the client determine the permissions granted to the client:
12
12
13
13
| Role | Permission |
14
14
|---|---|
@@ -18,4 +18,4 @@ A Web PubSub WebSocket client can only publish to other clients when it's author
18
18
| `webpubsub.joinLeaveGroup.<group>` | The client can join/leave the group `<group>`.
19
19
| `webpubsub.sendToGroup.<group>` | The client can publish messages to the group `<group>`.
20
20
21
-
The server can also dynamically grant or revoke permissions from the client through REST APIs or server SDKs.
21
+
The server can dynamically grant or revoke permissions from the client through REST APIs or server SDKs.
title: Reference - Azure Web PubSub JSON WebSocket subprotocol `json.reliable.webpubsub.azure.v1`
3
3
description: The reference describes Azure Web PubSub supported WebSocket subprotocol `json.reliable.webpubsub.azure.v1`
4
4
author: zackliu
5
5
ms.author: chenyl
6
6
ms.service: azure-web-pubsub
7
7
ms.topic: conceptual
8
-
ms.date: 01/04/2023
8
+
ms.date: 01/09/2023
9
9
---
10
10
11
-
# Azure Web PubSub supported Reliable JSON WebSocket subprotocol
11
+
# Azure Web PubSub Reliable JSON WebSocket subprotocol
12
12
13
-
The JSON WebSocket subprotocol, `json.reliable.webpubsub.azure.v1`, enables the highly reliable exchange of publish/subscribe messages directly between clients even under network issues.
13
+
The JSON WebSocket subprotocol, `json.reliable.webpubsub.azure.v1`, enables the highly reliable exchange of publish/subscribe messages directly between clients even during network issues.
14
14
15
15
This document describes the subprotocol json.reliable.webpubsub.azure.v1.
16
16
17
17
> [!NOTE]
18
-
> Reliable protocols are still in preview. Some changes are expected in future.
18
+
> Reliable protocols are still in preview. Some changes are expected in the future.
19
19
20
-
## Overview
20
+
When Websocket client connections drop due to intermittent network issues, messages can be lost. In a pubsub system, publishers are decoupled from subscribers and may not detect a subscribers' dropped connection or message loss.
21
21
22
-
When Websocket client connections drop due to intermittent network issues, messages can be lost. In a pubsub system, publishers are decoupled from subscribers and may not detect a subscribers' dropped connection or message loss. To overcome intermittent network issues and maintain reliable message delivery, you can use the Azure WebPubSub `json.reliable.webpubsub.azure.v1` subprotocol to create a *Reliable PubSub WebSocket client*. A *Reliable PubSub WebSocket client* can reconnect a dropped connection.
22
+
To overcome intermittent network issues and maintain reliable message delivery, you can use the Azure WebPubSub `json.reliable.webpubsub.azure.v1` subprotocol to create a *Reliable PubSub WebSocket client*. A *Reliable PubSub WebSocket client* can reconnect a dropped connection.
23
23
24
-
For example, in JavaScript, you can create a *Reliable PubSub WebSocket client* with the following code:
24
+
For example, you can create a *Reliable PubSub WebSocket client* with the following JavaScript code:
25
25
26
26
```js
27
27
var pubsub =newWebSocket('wss://test.webpubsub.azure.com/client/hubs/hub1', 'json.reliable.webpubsub.azure.v1');
28
28
```
29
29
30
-
When using `json.reliable.webpubsub.azure.v1` subprotocol, see [How to create reliable clients](./howto-develop-reliable-clients.md) to implement reconnection, publisher and subscriber for clients.
30
+
See [How to create reliable clients](./howto-develop-reliable-clients.md) to implement reconnection and message reliability for publisher and subscriber clients.
31
31
32
-
When the client is using this subprotocol, both outgoing data frame and incoming data frame are expected to be **JSON** payloads.
32
+
When the client is using this subprotocol, both outgoing and incoming data frames are expected to contain JSON payloads.
Reliable PubSub WebSocket client must send a sequence ack message once it receives a message from the service. Find more in[How to create reliable clients](./howto-develop-reliable-clients.md#subscriber)
51
+
Reliable PubSub WebSocket client must send a sequence ack message once it receives a message from the service. For more information, see[How to create reliable clients](./howto-develop-reliable-clients.md#subscriber)
52
52
53
53
*`sequenceId` is a incremental uint64 number from the message received.
54
54
@@ -58,7 +58,7 @@ Messages received by the client can be several types: `ack`, `message`, and `sys
58
58
59
59
### Ack response
60
60
61
-
If the request contains `ackId`, the service will return an ack response for this request. The client implementation should handle this ack mechanism, including waiting for the ack response for an `async``await` operation, and having a timeout check when the ack response is not received during a certain period.
61
+
When the request contains `ackId`, the service will return an ack response for this request. The client implementation should handle this ack mechanism, including waiting for the ack response using an `async``await` operation, and have a timeout handler when the ack response is not received during a certain period.
62
62
63
63
Format:
64
64
```json
@@ -106,8 +106,10 @@ Clients can receive messages published from one group the client joined, or from
106
106
```
107
107
108
108
#### Case 1: Sending data `Hello World` to the connection through REST API with `Content-Type`=`text/plain`
109
-
* What a simple WebSocket client receives is a text WebSocket frame with data: `Hello World`;
110
-
* What a PubSub WebSocket client receives is as follows:
109
+
110
+
* A simple WebSocket client receives a text WebSocket frame with data: `Hello World`;
111
+
* A PubSub WebSocket client receives the message in JSON:
112
+
111
113
```json
112
114
{
113
115
"sequenceId": 1,
@@ -119,8 +121,10 @@ Clients can receive messages published from one group the client joined, or from
119
121
```
120
122
121
123
#### Case 2: Sending data `{ "Hello" : "World"}` to the connection through REST API with `Content-Type`=`application/json`
122
-
* What a simple WebSocket client receives is a text WebSocket frame with stringified data: `{ "Hello" : "World"}`;
123
-
* What a PubSub WebSocket client receives is as follows:
124
+
125
+
* A simple WebSocket client receives a text WebSocket frame with stringified data: `{ "Hello" : "World"}`;
126
+
* A PubSub WebSocket client receives the message in JSON:
127
+
124
128
```json
125
129
{
126
130
"sequenceId": 1,
@@ -136,8 +140,10 @@ Clients can receive messages published from one group the client joined, or from
136
140
If the REST API is sending a string `Hello World` using `application/json` content type, what the simple WebSocket client receives is a JSON string, which is `"Hello World"` that wraps the string with `"`.
137
141
138
142
#### Case 3: Sending binary data to the connection through REST API with `Content-Type`=`application/octet-stream`
139
-
* What a simple WebSocket client receives is a binary WebSocket frame with the binary data.
140
-
* What a PubSub WebSocket client receives is as follows:
143
+
144
+
* A simple WebSocket client receives a binary WebSocket frame with the binary data.
145
+
* A PubSub WebSocket client receives the message in JSON:
0 commit comments