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
`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.
@@ -163,7 +151,7 @@ Here's an `WebPubSubTrigger` attribute in a method signature:
163
151
```csharp
164
152
[FunctionName("WebPubSubTrigger")]
165
153
public static void Run([WebPubSubTrigger("<hub>", <WebPubSubEventType>, "<event-name>")]
166
-
WebPubSubConnectionContext context, ILogger log)
154
+
WebPubSubConnectionContext context, ILogger log)
167
155
{
168
156
...
169
157
}
@@ -203,6 +191,9 @@ In weakly typed language like JavaScript, `name` in `function.json` will be used
203
191
|clientCertificates|`IList<ClientCertificate>`|A list of certificate thumbprint from clients in system `connect` request|-|
204
192
|reason|`string`|Reason in system `disconnected` request|-|
205
193
194
+
> [!IMPORTANT]
195
+
> In C#, multiple types supported parameter __MUST__ be put in the first, i.e. `request` or `data` that other than the default `BinaryData` type to make the function binding correctly.
196
+
206
197
### Return response
207
198
208
199
`WebPubSubTrigger` will respect customer returned response for synchronous events of `connect` and user event. Only matched response will be sent back to service, otherwise, it will be ignored. Besides, `WebPubSubTrigger` return object supports users to `SetState()` and `ClearStates()` to manage the metadata for the connection. And the extension will merge the results from return value with the original ones from request `WebPubSubConnectionContext.States`. Value in existing key will be overwrite and value in new key will be added.
0 commit comments