Skip to content

Commit 932ea13

Browse files
committed
more edits
1 parent 60cb523 commit 932ea13

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

articles/azure-web-pubsub/includes/reference-permission.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.date: 08/06/2021
88

99
## Permissions
1010

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:
1212

1313
| Role | Permission |
1414
|---|---|
@@ -18,4 +18,4 @@ A Web PubSub WebSocket client can only publish to other clients when it's author
1818
| `webpubsub.joinLeaveGroup.<group>` | The client can join/leave the group `<group>`.
1919
| `webpubsub.sendToGroup.<group>` | The client can publish messages to the group `<group>`.
2020

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.

articles/azure-web-pubsub/reference-json-reliable-webpubsub-subprotocol.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
---
2-
title: Reference - Azure Web PubSub supported JSON WebSocket subprotocol `json.reliable.webpubsub.azure.v1`
2+
title: Reference - Azure Web PubSub JSON WebSocket subprotocol `json.reliable.webpubsub.azure.v1`
33
description: The reference describes Azure Web PubSub supported WebSocket subprotocol `json.reliable.webpubsub.azure.v1`
44
author: zackliu
55
ms.author: chenyl
66
ms.service: azure-web-pubsub
77
ms.topic: conceptual
8-
ms.date: 01/04/2023
8+
ms.date: 01/09/2023
99
---
1010

11-
# Azure Web PubSub supported Reliable JSON WebSocket subprotocol
11+
# Azure Web PubSub Reliable JSON WebSocket subprotocol
1212

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.
1414

1515
This document describes the subprotocol json.reliable.webpubsub.azure.v1.
1616

1717
> [!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.
1919
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.
2121

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.
2323

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:
2525

2626
```js
2727
var pubsub = new WebSocket('wss://test.webpubsub.azure.com/client/hubs/hub1', 'json.reliable.webpubsub.azure.v1');
2828
```
2929

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.
3131

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.
3333

3434
[!INCLUDE [reference-permission](includes/reference-permission.md)]
3535

@@ -48,7 +48,7 @@ Format:
4848
}
4949
```
5050

51-
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)
5252

5353
* `sequenceId` is a incremental uint64 number from the message received.
5454

@@ -58,7 +58,7 @@ Messages received by the client can be several types: `ack`, `message`, and `sys
5858

5959
### Ack response
6060

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.
6262

6363
Format:
6464
```json
@@ -106,8 +106,10 @@ Clients can receive messages published from one group the client joined, or from
106106
```
107107

108108
#### 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+
111113
```json
112114
{
113115
"sequenceId": 1,
@@ -119,8 +121,10 @@ Clients can receive messages published from one group the client joined, or from
119121
```
120122

121123
#### 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+
124128
```json
125129
{
126130
"sequenceId": 1,
@@ -136,8 +140,10 @@ Clients can receive messages published from one group the client joined, or from
136140
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 `"`.
137141

138142
#### 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:
146+
141147
```json
142148
{
143149
"sequenceId": 1,

0 commit comments

Comments
 (0)