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/concept-client-protocols.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,20 +23,20 @@ The Web PubSub service provides two types of endpoints for clients to connect to
23
23
24
24
Clients connect to the service with a JSON Web Token (JWT). The token can be in either the query string, as `/client/?hub={hub}&access_token={token}`, or the `Authorization` header, as `Authorization: Bearer {token}`.
25
25
26
-
Here is a general authorization workflow:
26
+
Here's a general authorization workflow:
27
27
28
28
1. The client negotiates with your application server. The application server contains the authorization middleware, which handles the client request and signs a JWT for the client to connect to the service.
29
29
1. The application server returns the JWT and the service URL to the client.
30
-
1. The client tries to connect to the Web PubSub service by using the URL and the JWT that's returned from the application server.
30
+
1. The client tries to connect to the Web PubSub service by using the URL and the JWT token returned from the application server.
31
31
32
-
You could also configure additional properties for the client connection when generating the access token by specifying special claims inside the JWT token:
32
+
You could also configure properties for the client connection when generating the access token by specifying special claims inside the JWT token:
33
33
34
34
| Description | Claim type | Claim value | Notes |
35
-
| --- | ---| --- | -- |
35
+
| --- | ---| --- |--|
36
36
| The `userId` for the client connection |`sub`| the userId | Only one `sub` claim is allowed |
37
37
| The lifetime of the token |`exp`| the expiration time | The `exp` (expiration time) claim identifies the expiration time on or after which the token MUST NOT be accepted for processing. |
38
-
| The [permissions](#permissions) the client connection initially has |`role`| the role value defined in [permissions](#permissions)| Specify mulitple`role` claims if the client has multiple permissions |
39
-
| The initial groups that the client connection joins once it connects to Azure Web PubSub |`group`|`{groupToJoin}`|Sepcify multiple `group` claims if the client joins multiple groups|
38
+
| The [permissions](#permissions) the client connection initially has |`role`| the role value defined in [permissions](#permissions)| Specify multiple`role` claims if the client has multiple permissions |
39
+
| The initial groups that the client connection joins once it connects to Azure Web PubSub | `group` | `{groupToJoin}` | Specify multiple `group` claims if the client joins multiple groups|.
40
40
41
41
You could also add custom claims into the access token, and these values are preserved as the `claims` property in [connect upstream request body](./reference-cloud-events.md#system-connect-event).
42
42
@@ -60,7 +60,7 @@ var client2 = new WebSocket('wss://test.webpubsub.azure.com/client/hubs/hub1', '
60
60
61
61
## The PubSub WebSocket client
62
62
63
-
A **PubSub WebSocket client**, is the WebSocket client using subprotocols defined by the Azure Web PubSub service:
63
+
A **PubSub WebSocket client** is the WebSocket client using subprotocols defined by the Azure Web PubSub service:
64
64
65
65
*`json.webpubsub.azure.v1`
66
66
*`protobuf.webpubsub.azure.v1`
@@ -125,13 +125,13 @@ The **PubSub WebSocket Client** supports `ackId` property for `joinGroup`, `leav
125
125
126
126
#### Behavior when No `ackId` specified
127
127
128
-
If `ackId`is not specified, it's fire-and-forget. Even there're errors when brokering messages, you have no way to get notified.
128
+
If `ackId`isn't specified, it's fire-and-forget. Even there are errors when brokering messages, you have no way to get notified.
129
129
130
130
#### Behavior when `ackId` specified
131
131
132
132
##### Idempotent publish
133
133
134
-
`ackId` is a uint64 number and should be unique within a client with the same connection id. Web PubSub Service records the `ackId` and messages with the same `ackId`will be treated as the same message. The service refuses to broker the same message more than once, which is useful in retry to avoid duplicated messages. For example, if a client sends a message with `ackId=5` and fails to receive an ack response with `ackId=5`, then the client retries and sends the same message again. In some cases, the message is already brokered and the ack response is lost for some reason, the service will reject the retry and response an ack response with `Duplicate` reason.
134
+
`ackId` is a uint64 number and should be unique within a client with the same connection ID. Web PubSub Service records the `ackId` and messages with the same `ackId`are treated as the same message. The service refuses to broker the same message more than once, which is useful in retry to avoid duplicated messages. For example, if a client sends a message with `ackId=5` and fails to receive an ack response with `ackId=5`, then the client retries and sends the same message again. In some cases, the message is already brokered and the ack response is lost for some reason. The service rejects the retry and response an ack response with `Duplicate` reason.
135
135
136
136
#### Ack Response
137
137
@@ -152,7 +152,7 @@ Format:
152
152
153
153
* The `ackId` associates the request.
154
154
155
-
*`success` is a bool and indicate whether the request is successfully processed by the service. If it is`false`, clients need to check the `error`.
155
+
*`success` is a bool and indicate whether the request is successfully processed by the service. If it's`false`, clients need to check the `error`.
156
156
157
157
*`error` only exists when `success` is `false` and clients should have different logic for different `name`. You should suppose there might be more type of `name` in future.
158
158
-`Forbidden`: The client doesn't have the permission to the request. The client needs to be added relevant roles.
@@ -176,7 +176,7 @@ The permission of a client can be granted in several ways:
176
176
177
177
#### 1. Assign the role to the client when generating the access token
178
178
179
-
Client can connect to the service using a JWT token, the token payload can carry information such as the `role` of the client. When signing the JWT token to the client, you can grant permissions to the client by giving the client specific roles.
179
+
Client can connect to the service using a JWT token. The token payload can carry information such as the `role` of the client. When signing the JWT token to the client, you can grant permissions to the client by giving the client specific roles.
180
180
181
181
For example, let's sign a JWT token that has the permission to send messages to `group1` and `group2`:
0 commit comments