Skip to content

Commit e772264

Browse files
authored
Fix a name
1 parent 4ccb79e commit e772264

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: vicancy
55
ms.author: lianwei
66
ms.service: azure-web-pubsub
77
ms.topic: conceptual
8-
ms.date: 07/04/2022
8+
ms.date: 04/04/2023
99
---
1010

1111
# Azure Web PubSub trigger and bindings for Azure Functions
@@ -40,7 +40,7 @@ Working with the trigger and bindings requires you reference the appropriate pac
4040
> Install the client library from [NuGet](https://www.nuget.org/) with specified package and version.
4141
>
4242
> ```bash
43-
> func extensions install --package Microsoft.Azure.WebJobs.Extensions.WebPubSub --version 1.0.0
43+
> func extensions install --package Microsoft.Azure.WebJobs.Extensions.WebPubSub
4444
> ```
4545
4646
[NuGet package]: https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.WebPubSub
@@ -94,19 +94,11 @@ public static void Run(
9494
`WebPubSubTrigger` binding also supports return value in synchronize scenarios, for example, system `Connect` and user event, when server can check and deny the client request, or send messages to the caller directly. `Connect` event respects `ConnectEventResponse` and `EventErrorResponse`, and user event respects `UserEventResponse` and `EventErrorResponse`, rest types not matching current scenario will be ignored. And if `EventErrorResponse` is returned, service will drop the client connection.
9595
9696
```cs
97-
[FunctionName("WebPubSubTriggerReturnValue")]
98-
public static MessageResponse Run(
99-
[WebPubSubTrigger("<hub>", WebPubSubEventType.User, "message")]
100-
UserEventRequest request,
101-
ConnectionContext context,
102-
string data,
103-
WebPubSubDataType dataType)
97+
[FunctionName("WebPubSubTriggerReturnValueFunction")]
98+
public static UserEventResponse Run(
99+
[WebPubSubTrigger("hub", WebPubSubEventType.User, "message")] UserEventRequest request)
104100
{
105-
return new UserEventResponse
106-
{
107-
Data = BinaryData.FromString("ack"),
108-
DataType = WebPubSubDataType.Text
109-
};
101+
return request.CreateResponse(BinaryData.FromString("ack"), WebPubSubDataType.Text);
110102
}
111103
```
112104

0 commit comments

Comments
 (0)