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-functions/functions-bindings-web-pubsub-input.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,18 +17,18 @@ Our extension provides two input binding targeting different needs.
17
17
18
18
-[`WebPubSubConnection`](#webpubsubconnection)
19
19
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.
21
21
22
22
-[`WebPubSubContext`](#webpubsubcontext)
23
23
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.
25
25
When used with `HttpTrigger`, customer requires to configure the HttpTrigger exposed url in event handler accordingly.
26
26
27
27
## `WebPubSubConnection`
28
28
29
29
### Example
30
30
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}`.
> The Web PubSub extensions for Java is not supported yet.
343
+
> The Web PubSub extensions for Java isn't supported yet.
344
344
345
345
::: zone-end
346
346
@@ -355,14 +355,14 @@ The following table explains the binding configuration properties that you set i
355
355
|**name**| n/a | Variable name used in function code for input connection binding object. |
356
356
|**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. |
357
357
|**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`. |
359
359
|**connection**| Connection | Required - The name of the app setting that contains the Web PubSub Service connection string (defaults to "WebPubSubConnectionString"). |
360
360
361
361
### Usage
362
362
363
363
::: zone pivot="programming-language-csharp"
364
364
365
-
`WebPubSubConnection` provides below properties.
365
+
`WebPubSubConnection` provides following properties.
366
366
367
367
| Binding Name | Binding Type | Description |
368
368
|---------|---------|---------|
@@ -375,7 +375,7 @@ The following table explains the binding configuration properties that you set i
375
375
376
376
::: zone pivot="programming-language-javascript,programming-language-python,programming-language-powershell"
377
377
378
-
`WebPubSubConnection` provides below properties.
378
+
`WebPubSubConnection` provides following properties.
379
379
380
380
| Binding Name | Description |
381
381
|---------|---------|
@@ -387,17 +387,17 @@ The following table explains the binding configuration properties that you set i
387
387
388
388
::: zone pivot="programming-language-java"
389
389
> [!NOTE]
390
-
> The Web PubSub extensions for Java is not supported yet.
390
+
> The Web PubSub extensions for Java isn't supported yet.
391
391
::: zone-end
392
392
393
393
394
394
### More customization of generated token
395
395
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`.
397
397
398
398
::: zone pivot="programming-language-csharp"
399
399
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).
401
401
402
402
# [Isolated worker model](#tab/isolated-process)
403
403
@@ -437,7 +437,7 @@ public static async Task<Uri> Run(
437
437
438
438
::: zone pivot="programming-language-javascript"
439
439
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).
> The Web PubSub extensions for Java is not supported yet.
646
+
> The Web PubSub extensions for Java isn't supported yet.
647
647
648
648
::: zone-end
649
649
@@ -656,22 +656,22 @@ The following table explains the binding configuration properties that you set i
656
656
|**type**| n/a | Must be set to `webPubSubContext`. |
657
657
|**direction**| n/a | Must be set to `in`. |
658
658
|**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. |
660
660
661
661
662
662
### Usage
663
663
664
-
`WebPubSubContext` provides below properties.
664
+
`WebPubSubContext` provides following properties.
665
665
666
666
| Binding Name | Binding Type | Description | Properties |
667
667
|---------|---------|---------|---------|
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`. |
669
669
| response |`HttpResponseMessage`| Extension builds response mainly for `AbuseProtection` and errors cases. | - |
670
670
| errorMessage | string | Describe the error details when processing the upstream request. | - |
671
671
| hasError | bool | Flag to indicate whether it's a valid Web PubSub upstream request. | - |
672
672
| isPreflight | bool | Flag to indicate whether it's a preflight request of `AbuseProtection`. | - |
673
673
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.
675
675
676
676
| Derived Class | Description | Properties |
677
677
| -- | -- | -- |
@@ -682,4 +682,4 @@ For `WebPubSubEventRequest`, it's deserialized to different classes that provide
682
682
|`DisconnectedEventRequest`| Used in system `Disconnected` event type | Reason |
683
683
684
684
> [!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**.
> 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`.
197
197
>
198
198
> 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.
0 commit comments