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/howto-develop-reliable-clients.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,13 +23,13 @@ The Web PubSub service supports two reliable subprotocols `json.reliable.webpubs
23
23
24
24
To use reliable subprotocols, you must set the subprotocol when constructing Websocket connections. In JavaScript, you can use the following code:
25
25
26
-
- Use Json reliable subprotocol
26
+
- Use Json reliable subprotocol:
27
27
28
28
```js
29
29
var pubsub =newWebSocket('wss://test.webpubsub.azure.com/client/hubs/hub1', 'json.reliable.webpubsub.azure.v1');
30
30
```
31
31
32
-
- Use Protobuf reliable subprotocol
32
+
- Use Protobuf reliable subprotocol:
33
33
34
34
```js
35
35
var pubsub = new WebSocket('wss://test.webpubsub.azure.com/client/hubs/hub1', 'protobuf.reliable.webpubsub.azure.v1');
@@ -52,7 +52,7 @@ When the client reconnects to the service using reliable subprotocols, the clien
52
52
}
53
53
```
54
54
55
-
Once the WebSocket connection drops, the client should try to reconnect with the same `connectionId` to keep the restore the same session. Clients don't need to negotiate with the server and obtain the `access_token`. Instead, reconnection should make a websocket connect request directly to the service with the service host name, `connection_id`, and `reconnection_token`:
55
+
Once the WebSocket connection drops, the client should try to reconnect with the same `connectionId` to restore the same session. Clients don't need to negotiate with the server and obtain the `access_token`. Instead, on reconnection the client should make a WebSocket connect request directly to the service with the service host name, `connection_id`, and `reconnection_token`:
@@ -65,7 +65,9 @@ Reconnection may fail if the network issue hasn't been recovered yet. The client
65
65
66
66
## Publisher
67
67
68
-
Clients that send events to event handlers or publish messages to other clients are called publishers. Publishers should set `ackId` in the message to receive an acknowledgment from the Web PubSub service that publishing the message was successful or not. The `ackId` in message is the identifier of the message, each new message should use a unique ID. The original `ackId` should be used when resending a message.
68
+
Clients that send events to event handlers or publish messages to other clients are called publishers. Publishers should set `ackId` in the message to receive an acknowledgment from the Web PubSub service that publishing the message was successful or not.
69
+
70
+
The `ackId` is the identifier of the message, each new message should use a unique ID. The original `ackId` should be used when resending a message.
69
71
70
72
A sample group send message:
71
73
@@ -107,7 +109,7 @@ When the service experiences a transient internal error and the message can't be
If the service's ack response is lost because the WebSocket connection dropped, the publisher should resend message with the same `ackId` after reconnection. When the message was previously processed by the service, it will send an ack containing a `Duplicate` error and the publisher should stop resending this message.
112
+
If the service's ack response is lost because the WebSocket connection dropped, the publisher should resend the message with the same `ackId` after reconnection. When the message was previously processed by the service, it will send an ack containing a `Duplicate` error. The publisher should stop resending this message.
0 commit comments