Skip to content

Commit ee44e95

Browse files
authored
fix
1 parent 447e26a commit ee44e95

File tree

3 files changed

+35
-36
lines changed

3 files changed

+35
-36
lines changed

articles/azure-functions/functions-bindings-web-pubsub-input.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ Our extension provides two input binding targeting different needs.
1717

1818
- [`WebPubSubConnection`](#webpubsubconnection)
1919

20-
To let a client connect to Azure Web PubSub Service, it must know the service endpoint URL and a valid access token. The `WebPubSubConnection` input binding produces required information, so client doesn't need to handle this token generation itself. Because the token is time-limited and can be used to authenticate a specific user to a connection, don't cache the token or share it between clients. An HTTP trigger working with this input binding can be used for clients to retrieve the connection information.
20+
To let a client connect to Azure Web PubSub Service, it must know the service endpoint URL and a valid access token. The `WebPubSubConnection` input binding produces required information, so client doesn't need to handle this token generation itself. The token is time-limited and can authenticate a specific user to a connection. Therefore, don't cache the token or share it between clients. An HTTP trigger working with this input binding can be used for clients to retrieve the connection information.
2121

2222
- [`WebPubSubContext`](#webpubsubcontext)
2323

24-
When using is Static Web Apps, `HttpTrigger` is the only supported trigger and under Web PubSub scenario, we provide the `WebPubSubContext` input binding helps users deserialize upstream http request from service side under Web PubSub protocols. So customers can get similar results comparing to `WebPubSubTrigger` to easily handle in functions. See [examples](#example---webpubsubcontext) in below.
24+
When using is Static Web Apps, `HttpTrigger` is the only supported trigger and under Web PubSub scenario, we provide the `WebPubSubContext` input binding helps users deserialize upstream http request from service side under Web PubSub protocols. So customers can get similar results comparing to `WebPubSubTrigger` to easily handle in functions.
2525
When used with `HttpTrigger`, customer requires to configure the HttpTrigger exposed url in event handler accordingly.
2626

2727
## `WebPubSubConnection`
2828

2929
### Example
3030

31-
The following example shows an HTTP trigger function that acquires Web PubSub connection information using the input binding and returns it over HTTP. In below example, the `UserId` is passed in through client request query part like `?userid={User-A}`.
31+
The following example shows an HTTP trigger function that acquires Web PubSub connection information using the input binding and returns it over HTTP. In following example, the `UserId` is passed in through client request query part like `?userid={User-A}`.
3232

3333
::: zone pivot="programming-language-csharp"
3434

@@ -179,7 +179,7 @@ def main(req: func.HttpRequest, connection) -> func.HttpResponse:
179179
::: zone pivot="programming-language-java"
180180

181181
> [!NOTE]
182-
> The Web PubSub extensions for Java is not supported yet.
182+
> The Web PubSub extensions for Java isn't supported yet.
183183
184184
::: zone-end
185185

@@ -340,7 +340,7 @@ def main(req: func.HttpRequest, connection) -> func.HttpResponse:
340340
::: zone pivot="programming-language-java"
341341

342342
> [!NOTE]
343-
> The Web PubSub extensions for Java is not supported yet.
343+
> The Web PubSub extensions for Java isn't supported yet.
344344
345345
::: zone-end
346346

@@ -355,14 +355,14 @@ The following table explains the binding configuration properties that you set i
355355
| **name** | n/a | Variable name used in function code for input connection binding object. |
356356
| **hub** | Hub | Required - The value must be set to the name of the Web PubSub hub for the function to be triggered. We support set the value in attribute as higher priority, or it can be set in app settings as a global value. |
357357
| **userId** | UserId | Optional - the value of the user identifier claim to be set in the access key token. |
358-
| **clientProtocol** | ClientProtocol | Optional - The client protocol type. Valid values includes `default`, `mqtt` <br> For MQTT clients, you must set it to `mqtt`. <br> For other clients, you can omit the property or set it to `default`. |
358+
| **clientProtocol** | ClientProtocol | Optional - The client protocol type. Valid values include `default` and `mqtt`. <br> For MQTT clients, you must set it to `mqtt`. <br> For other clients, you can omit the property or set it to `default`. |
359359
| **connection** | Connection | Required - The name of the app setting that contains the Web PubSub Service connection string (defaults to "WebPubSubConnectionString"). |
360360

361361
### Usage
362362

363363
::: zone pivot="programming-language-csharp"
364364

365-
`WebPubSubConnection` provides below properties.
365+
`WebPubSubConnection` provides following properties.
366366

367367
| Binding Name | Binding Type | Description |
368368
|---------|---------|---------|
@@ -375,7 +375,7 @@ The following table explains the binding configuration properties that you set i
375375

376376
::: zone pivot="programming-language-javascript,programming-language-python,programming-language-powershell"
377377

378-
`WebPubSubConnection` provides below properties.
378+
`WebPubSubConnection` provides following properties.
379379

380380
| Binding Name | Description |
381381
|---------|---------|
@@ -387,17 +387,17 @@ The following table explains the binding configuration properties that you set i
387387

388388
::: zone pivot="programming-language-java"
389389
> [!NOTE]
390-
> The Web PubSub extensions for Java is not supported yet.
390+
> The Web PubSub extensions for Java isn't supported yet.
391391
::: zone-end
392392

393393

394394
### More customization of generated token
395395

396-
Limited to the binding parameter types don't support a way to pass list nor array, the `WebPubSubConnection` is not fully supported with all the parameters server SDK has, especially `roles`, and also includes `groups` and `expiresAfter`.
396+
Limited to the binding parameter types don't support a way to pass list nor array, the `WebPubSubConnection` isn't fully supported with all the parameters server SDK has, especially `roles`, and also includes `groups` and `expiresAfter`.
397397

398398
::: zone pivot="programming-language-csharp"
399399

400-
In the case customer needs to add roles or delay build the access token in the function, it's suggested to work with [server SDK for C#](/dotnet/api/overview/azure/messaging.webpubsub-readme).
400+
When customer needs to add roles or delay buildinging the access token in the function, we suggest you to work with [server SDK for C#](/dotnet/api/overview/azure/messaging.webpubsub-readme).
401401

402402
# [Isolated worker model](#tab/isolated-process)
403403

@@ -437,7 +437,7 @@ public static async Task<Uri> Run(
437437

438438
::: zone pivot="programming-language-javascript"
439439

440-
In the case customer needs to add roles or delay build the access token in the function, it's suggested to work with [server SDK for JavaScript](/javascript/api/overview/azure/web-pubsub).
440+
When customer needs to add roles or delay building the access token in the function, we suggest you working with [server SDK for JavaScript](/javascript/api/overview/azure/web-pubsub).
441441

442442
# [Model v4](#tab/nodejs-v4)
443443

@@ -502,7 +502,7 @@ module.exports = async function (context, req) {
502502
::: zone pivot="programming-language-java"
503503

504504
> [!NOTE]
505-
> The Web PubSub extensions for Java is not supported yet.
505+
> The Web PubSub extensions for Java isn't supported yet.
506506
507507
::: zone-end
508508

@@ -643,7 +643,7 @@ module.exports = async function (context, req, wpsContext) {
643643
::: zone pivot="programming-language-java"
644644

645645
> [!NOTE]
646-
> The Web PubSub extensions for Java is not supported yet.
646+
> The Web PubSub extensions for Java isn't supported yet.
647647
648648
::: zone-end
649649

@@ -656,22 +656,22 @@ The following table explains the binding configuration properties that you set i
656656
| **type** | n/a | Must be set to `webPubSubContext`. |
657657
| **direction** | n/a | Must be set to `in`. |
658658
| **name** | n/a | Variable name used in function code for input Web PubSub request. |
659-
| **connection** | Connection | Optional - the name of an app settings or setting collection that specifies the upstream Azure Web PubSub service. The value is used for [Abuse Protection](https://github.com/cloudevents/spec/blob/v1.0.1/http-webhook.md#4-abuse-protection) and Signature validation. The value is auto resolved with "WebPubSubConnectionString" by default. And `null` means the validation is not needed and always succeed. |
659+
| **connection** | Connection | Optional - the name of an app settings or setting collection that specifies the upstream Azure Web PubSub service. The value is used for [Abuse Protection](https://github.com/cloudevents/spec/blob/v1.0.1/http-webhook.md#4-abuse-protection) and Signature validation. The value is auto resolved with "WebPubSubConnectionString" by default. And `null` means the validation isn't needed and always succeed. |
660660

661661

662662
### Usage
663663

664-
`WebPubSubContext` provides below properties.
664+
`WebPubSubContext` provides following properties.
665665

666666
| Binding Name | Binding Type | Description | Properties |
667667
|---------|---------|---------|---------|
668-
| request | `WebPubSubEventRequest` | Request from client, see below table for details. | `WebPubSubConnectionContext` from request header and other properties deserialized from request body describe the request, for example, `Reason` for `DisconnectedEventRequest`. |
668+
| request | `WebPubSubEventRequest` | Request from client, see following table for details. | `WebPubSubConnectionContext` from request header and other properties deserialized from request body describe the request, for example, `Reason` for `DisconnectedEventRequest`. |
669669
| response | `HttpResponseMessage` | Extension builds response mainly for `AbuseProtection` and errors cases. | - |
670670
| errorMessage | string | Describe the error details when processing the upstream request. | - |
671671
| hasError | bool | Flag to indicate whether it's a valid Web PubSub upstream request. | - |
672672
| isPreflight | bool | Flag to indicate whether it's a preflight request of `AbuseProtection`. | - |
673673

674-
For `WebPubSubEventRequest`, it's deserialized to different classes that provide different information about the request scenario. For `PreflightRequest` or not valid cases, user can check the flags `IsPreflight` and `HasError` to know. It's suggested to return system build response `WebPubSubContext.Response` directly, or customer can log errors on demand. In different scenarios, customer can read the request properties as below.
674+
For `WebPubSubEventRequest`, it's deserialized to different classes that provide different information about the request scenario. For `PreflightRequest` or not valid cases, user can check the flags `IsPreflight` and `HasError` to know. We suggest you to return system build response `WebPubSubContext.Response` directly, or customer can log errors on demand. In different scenarios, customer can read the request properties as following.
675675

676676
| Derived Class | Description | Properties |
677677
| -- | -- | -- |
@@ -682,4 +682,4 @@ For `WebPubSubEventRequest`, it's deserialized to different classes that provide
682682
| `DisconnectedEventRequest` | Used in system `Disconnected` event type | Reason |
683683

684684
> [!NOTE]
685-
> Though the `WebPubSubContext` is a input binding provides similar request deserialize way under `HttpTrigger` comparing to `WebPubSubTrigger`, there's limitations, i.e. connection state post merge is not supported. The return response is still respected by the service side, but users require to build the response themselves. If users have needs to set the event response, you should return a `HttpResponseMessage` contains `ConnectEventResponse` or messages for user event as **response body** and put connection state with key `ce-connectionstate` in **response header**.
685+
> Though the `WebPubSubContext` is a input binding provides similar request deserialize way under `HttpTrigger` comparing to `WebPubSubTrigger`, there's limitations, i.e. connection state post merge isn't supported. The return response is still respected by the service side, but users require to build the response themselves. If users have needs to set the event response, you should return a `HttpResponseMessage` contains `ConnectEventResponse` or messages for user event as **response body** and put connection state with key `ce-connectionstate` in **response header**.

articles/azure-functions/functions-bindings-web-pubsub-output.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Use the *Web PubSub* output binding to invoke Azure Web PubSub service to do som
2020
* Connected clients joined in a specific group
2121
* A specific client connection
2222

23-
The output binding also allows you to manage clients and groups, as well as grant/revoke permissions targeting specific connectionId with group.
23+
The output binding also allows you to manage clients and groups, and grant/revoke permissions targeting specific connectionId with group.
2424

2525
* Add connection to group
2626
* Add user to group
@@ -171,9 +171,9 @@ In C# language, we provide a few static methods under `WebPubSubAction` to help
171171

172172
::: zone-end
173173

174-
::: zone pivot="programming-language-javascriptprogramming-language-pythonprogramming-language-powershell"
174+
::: zone pivot="programming-language-javascript,programming-language-python,programming-language-powershell"
175175

176-
**`actionName`** is the key parameter to resolve the type, available actions are listed as below.
176+
**`actionName`** is the key parameter to resolve the type. Available actions are listed as follows.
177177

178178
| ActionName | Properties |
179179
| -- | -- |
@@ -193,7 +193,7 @@ In C# language, we provide a few static methods under `WebPubSubAction` to help
193193
| `revokePermission`|ConnectionId, Permission, TargetName |
194194

195195
> [!IMPORTANT]
196-
> The message data property in the send message related actions must be `string` if data type is set to `json` or `text` to avoid data conversion ambiguity. Please use `JSON.stringify()` to convert the json object in need. This is applied to any place using message property, for example, `UserEventResponse.Data` working with `WebPubSubTrigger`.
196+
> The message data property in the sent message related actions must be `string` if data type is set to `json` or `text` to avoid data conversion ambiguity. Please use `JSON.stringify()` to convert the json object in need. This is applied to any place using message property, for example, `UserEventResponse.Data` working with `WebPubSubTrigger`.
197197
>
198198
> When data type is set to `binary`, it's allowed to leverage binding naturally supported `dataType` as `binary` configured in the `function.json`, see [Trigger and binding definitions](../azure-functions/functions-triggers-bindings.md?tabs=csharp#trigger-and-binding-definitions) for details.
199199

0 commit comments

Comments
 (0)