@azure/web-pubsub-express 1.0.6-alpha.20241122.1 → 1.0.6-alpha.20241126.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.11"
8
+ "packageVersion": "7.48.0"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/web-pubsub-express",
3
- "version": "1.0.6-alpha.20241122.1",
3
+ "version": "1.0.6-alpha.20241126.2",
4
4
  "description": "Azure Web PubSub CloudEvents handlers",
5
5
  "sdk-type": "client",
6
6
  "scripts": {
@@ -1,801 +0,0 @@
1
- import type express from 'express-serve-static-core';
2
-
3
- /**
4
- * The client certificate.
5
- */
6
- export declare interface Certificate {
7
- /**
8
- * The thumbprint of the certificate.
9
- */
10
- thumbprint: string;
11
- }
12
-
13
- /**
14
- * Request for the connected event.
15
- */
16
- export declare interface ConnectedRequest {
17
- /**
18
- * The context of current CloudEvents request.
19
- */
20
- context: ConnectionContext;
21
- }
22
-
23
- /**
24
- * Response of a failed connect event.
25
- */
26
- export declare interface ConnectErrorResponse {
27
- /**
28
- * The error code.
29
- */
30
- code: 400 | 401 | 500;
31
- /**
32
- * The error detail.
33
- */
34
- detail?: string;
35
- }
36
-
37
- /**
38
- * The connection context representing the client WebSocket connection.
39
- */
40
- export declare interface ConnectionContext {
41
- /**
42
- * The unique identifier generated by the service of the network connection.
43
- */
44
- signature: string;
45
- /**
46
- * The hub the connection belongs to.
47
- */
48
- hub: string;
49
- /**
50
- * The Id of the connection.
51
- */
52
- connectionId: string;
53
- /**
54
- * The event name of this CloudEvents request.
55
- */
56
- eventName: string;
57
- /**
58
- * The origin this CloudEvents request comes from.
59
- */
60
- origin: string;
61
- /**
62
- * The user id of the connection.
63
- */
64
- userId?: string;
65
- /**
66
- * The subprotocol of this connection.
67
- */
68
- subprotocol?: string;
69
- /**
70
- * Get the additional states for the connection, such states are perserved throughout the lifetime of the connection.
71
- */
72
- states: Record<string, any>;
73
- /**
74
- * The type of client protocol.
75
- */
76
- clientProtocol: WebPubSubClientProtocol;
77
- /**
78
- * The MQTT properties that the client WebSocket connection has when it connects (For MQTT connection only).
79
- */
80
- mqtt?: MqttConnectionContextProperties;
81
- }
82
-
83
- /**
84
- * Request for the connect event.
85
- */
86
- export declare interface ConnectRequest {
87
- /**
88
- * The context of current CloudEvents request.
89
- */
90
- context: ConnectionContext;
91
- /**
92
- * The claims that the client WebSocket connection has when it connects.
93
- */
94
- claims?: Record<string, string[]>;
95
- /**
96
- * The query that the client WebSocket connection has when it connects.
97
- * @deprecated Please use queries instead.
98
- */
99
- query?: Record<string, string[]>;
100
- /**
101
- * The queries that the client WebSocket connection has when it connects.
102
- */
103
- queries?: Record<string, string[]>;
104
- /**
105
- * The headers that the client WebSocket connection has when it connects.
106
- */
107
- headers?: Record<string, string[]>;
108
- /**
109
- * The subprotocols that the client WebSocket connection uses to do handshake.
110
- */
111
- subprotocols?: string[];
112
- /**
113
- * The client certificate info that the client WebSocket connection uses to connect.
114
- */
115
- clientCertificates?: Certificate[];
116
- }
117
-
118
- /**
119
- * Response of the connect event.
120
- */
121
- export declare interface ConnectResponse {
122
- /**
123
- * Set the groups the connection would like to join.
124
- */
125
- groups?: string[];
126
- /**
127
- * Set the roles the connection belongs to.
128
- */
129
- roles?: string[];
130
- /**
131
- * Set the userId for the connection.
132
- */
133
- userId?: string;
134
- /**
135
- * Set the subprotocol for the connection to complete WebSocket handshake.
136
- */
137
- subprotocol?: string;
138
- }
139
-
140
- /**
141
- * The handler to set connect event response
142
- */
143
- export declare interface ConnectResponseHandler {
144
- /**
145
- * Set the state of the connection
146
- * @param name - The name of the state
147
- * @param value - The value of the state
148
- */
149
- setState(name: string, value: unknown): void;
150
- /**
151
- * Return success response to the service.
152
- * @param response - The response for the connect event.
153
- */
154
- success(response?: ConnectResponse | MqttConnectResponse): void;
155
- /**
156
- * Return failed response and the service will reject the client WebSocket connection.
157
- * @param code - Code can be 400 user error, 401 unauthorized and 500 server error.
158
- * @param detail - The detail of the error.
159
- */
160
- fail(code: 400 | 401 | 500, detail?: string): void;
161
- /**
162
- * Return failed response with MQTT response properties and the service will reject the client WebSocket connection.
163
- * @param response - The response for the connect event which contains either default WebPubSub or MQTT response properties.
164
- */
165
- failWith(response: ConnectErrorResponse | MqttConnectErrorResponse): void;
166
- }
167
-
168
- /**
169
- * Request for the disconnected event.
170
- */
171
- export declare interface DisconnectedRequest {
172
- /**
173
- * The context of current CloudEvents request.
174
- */
175
- context: ConnectionContext;
176
- /**
177
- * The reason that the connection disconnects.
178
- */
179
- reason?: string;
180
- }
181
-
182
- /**
183
- * Response of an MQTT connection failure.
184
- */
185
- export declare interface MqttConnectErrorResponse {
186
- /**
187
- * The properties of the MQTT connection failure response.
188
- */
189
- mqtt: MqttConnectErrorResponseProperties;
190
- }
191
-
192
- /**
193
- * The properties of an MQTT connection failure response.
194
- */
195
- export declare interface MqttConnectErrorResponseProperties {
196
- /**
197
- * The MQTT connect return code.
198
- */
199
- code: MqttV311ConnectReturnCode | MqttV500ConnectReasonCode;
200
- /**
201
- * The reason string for the connection failure.
202
- */
203
- reason?: string;
204
- /**
205
- * The user properties in the response.
206
- */
207
- userProperties?: MqttUserProperty[];
208
- }
209
-
210
- /**
211
- * The connection context properties representing the MQTT client WebSocket connection.
212
- */
213
- export declare interface MqttConnectionContextProperties {
214
- /**
215
- * The unique identifier generated by the service of the network connection.
216
- */
217
- physicalConnectionId: string;
218
- /**
219
- * The unique identifier generated by the service of the MQTT session.
220
- */
221
- sessionId?: string;
222
- }
223
-
224
- /**
225
- * The properties of the MQTT CONNECT packet.
226
- */
227
- export declare interface MqttConnectProperties {
228
- /**
229
- * MQTT protocol version.
230
- */
231
- protocolVersion: number;
232
- /**
233
- * The username field in the MQTT CONNECT packet.
234
- */
235
- username?: string;
236
- /**
237
- * The password field in the MQTT CONNECT packet.
238
- */
239
- password?: string;
240
- /**
241
- * The user properties in the MQTT CONNECT packet.
242
- */
243
- userProperties?: MqttUserProperty[];
244
- }
245
-
246
- /**
247
- * Request for the MQTT connect event.
248
- */
249
- export declare interface MqttConnectRequest extends ConnectRequest {
250
- /**
251
- * The MQTT specific properties in the MQTT connect event request.
252
- */
253
- mqtt: MqttConnectProperties;
254
- }
255
-
256
- /**
257
- * Success respones of the connect event.
258
- */
259
- export declare interface MqttConnectResponse extends ConnectResponse {
260
- /**
261
- * The MQTT specific properties in a successful MQTT connection event response.
262
- */
263
- mqtt?: MqttConnectResponseProperties;
264
- }
265
-
266
- /**
267
- * The properties of a successful MQTT connection event response
268
- */
269
- export declare interface MqttConnectResponseProperties {
270
- /**
271
- * Additional diagnostic or other information provided by upstream server
272
- * Now only MQTT 5.0 supports user properties
273
- */
274
- userProperties?: MqttUserProperty[];
275
- }
276
-
277
- /**
278
- * The properties of an MQTT disconnected event.
279
- */
280
- export declare interface MqttDisconnectedProperties {
281
- /**
282
- * The MQTT disconnect packet.
283
- */
284
- disconnectPacket: MqttDisconnectPacket;
285
- /**
286
- * Whether the disconnection is initiated by the client.
287
- */
288
- initiatedByClient: boolean;
289
- }
290
-
291
- /**
292
- * Request for the disconnected event.
293
- */
294
- export declare interface MqttDisconnectedRequest extends DisconnectedRequest {
295
- /**
296
- * The MQTT specific properties in the MQTT disconnected event request.
297
- */
298
- mqtt: MqttDisconnectedProperties;
299
- }
300
-
301
- /**
302
- * The properties of the MQTT DISCONNECT packet.
303
- */
304
- export declare interface MqttDisconnectPacket {
305
- /**
306
- * The MQTT disconnect return code.
307
- */
308
- code: MqttDisconnectReasonCode;
309
- /**
310
- * The user properties in the MQTT disconnect packet.
311
- */
312
- userProperties?: MqttUserProperty[];
313
- }
314
-
315
- /**
316
- * MQTT 5.0 Disconnect Reason Codes.
317
- */
318
- export declare enum MqttDisconnectReasonCode {
319
- /**
320
- * 0x00 - Normal disconnection
321
- * Sent by: Client or Server
322
- * Description: Close the connection normally. Do not send the Will Message.
323
- */
324
- NormalDisconnection = 0,
325
- /**
326
- * 0x04 - Disconnect with Will Message
327
- * Sent by: Client
328
- * Description: The Client wishes to disconnect but requires that the Server also publishes its Will Message.
329
- */
330
- DisconnectWithWillMessage = 4,
331
- /**
332
- * 0x80 - Unspecified error
333
- * Sent by: Client or Server
334
- * Description: The Connection is closed but the sender either does not wish to reveal the reason, or none of the other Reason Codes apply.
335
- */
336
- UnspecifiedError = 128,
337
- /**
338
- * 0x81 - Malformed Packet
339
- * Sent by: Client or Server
340
- * Description: The received packet does not conform to this specification.
341
- */
342
- MalformedPacket = 129,
343
- /**
344
- * 0x82 - Protocol Error
345
- * Sent by: Client or Server
346
- * Description: An unexpected or out of order packet was received.
347
- */
348
- ProtocolError = 130,
349
- /**
350
- * 0x83 - Implementation specific error
351
- * Sent by: Client or Server
352
- * Description: The packet received is valid but cannot be processed by this implementation.
353
- */
354
- ImplementationSpecificError = 131,
355
- /**
356
- * 0x87 - Not authorized
357
- * Sent by: Server
358
- * Description: The request is not authorized.
359
- */
360
- NotAuthorized = 135,
361
- /**
362
- * 0x89 - Server busy
363
- * Sent by: Server
364
- * Description: The Server is busy and cannot continue processing requests from this Client.
365
- */
366
- ServerBusy = 137,
367
- /**
368
- * 0x8B - Server shutting down
369
- * Sent by: Server
370
- * Description: The Server is shutting down.
371
- */
372
- ServerShuttingDown = 139,
373
- /**
374
- * 0x8D - Keep Alive timeout
375
- * Sent by: Server
376
- * Description: The Connection is closed because no packet has been received for 1.5 times the Keepalive time.
377
- */
378
- KeepAliveTimeout = 141,
379
- /**
380
- * 0x8E - Session taken over
381
- * Sent by: Server
382
- * Description: Another Connection using the same ClientID has connected causing this Connection to be closed.
383
- */
384
- SessionTakenOver = 142,
385
- /**
386
- * 0x8F - Topic Filter invalid
387
- * Sent by: Server
388
- * Description: The Topic Filter is correctly formed, but is not accepted by this Server.
389
- */
390
- TopicFilterInvalid = 143,
391
- /**
392
- * 0x90 - Topic Name invalid
393
- * Sent by: Client or Server
394
- * Description: The Topic Name is correctly formed, but is not accepted by this Client or Server.
395
- */
396
- TopicNameInvalid = 144,
397
- /**
398
- * 0x93 - Receive Maximum exceeded
399
- * Sent by: Client or Server
400
- * Description: The Client or Server has received more than Receive Maximum publication for which it has not sent PUBACK or PUBCOMP.
401
- */
402
- ReceiveMaximumExceeded = 147,
403
- /**
404
- * 0x94 - Topic Alias invalid
405
- * Sent by: Client or Server
406
- * Description: The Client or Server has received a PUBLISH packet containing a Topic Alias which is greater than the Maximum Topic Alias it sent in the CONNECT or CONNACK packet.
407
- */
408
- TopicAliasInvalid = 148,
409
- /**
410
- * 0x95 - Packet too large
411
- * Sent by: Client or Server
412
- * Description: The packet size is greater than Maximum Packet Size for this Client or Server.
413
- */
414
- PacketTooLarge = 149,
415
- /**
416
- * 0x96 - Message rate too high
417
- * Sent by: Client or Server
418
- * Description: The received data rate is too high.
419
- */
420
- MessageRateTooHigh = 150,
421
- /**
422
- * 0x97 - Quota exceeded
423
- * Sent by: Client or Server
424
- * Description: An implementation or administrative imposed limit has been exceeded.
425
- */
426
- QuotaExceeded = 151,
427
- /**
428
- * 0x98 - Administrative action
429
- * Sent by: Client or Server
430
- * Description: The Connection is closed due to an administrative action.
431
- */
432
- AdministrativeAction = 152,
433
- /**
434
- * 0x99 - Payload format invalid
435
- * Sent by: Client or Server
436
- * Description: The payload format does not match the one specified by the Payload Format Indicator.
437
- */
438
- PayloadFormatInvalid = 153,
439
- /**
440
- * 0x9A - Retain not supported
441
- * Sent by: Server
442
- * Description: The Server does not support retained messages.
443
- */
444
- RetainNotSupported = 154,
445
- /**
446
- * 0x9B - QoS not supported
447
- * Sent by: Server
448
- * Description: The Client specified a QoS greater than the QoS specified in a Maximum QoS in the CONNACK.
449
- */
450
- QosNotSupported = 155,
451
- /**
452
- * 0x9C - Use another server
453
- * Sent by: Server
454
- * Description: The Client should temporarily change its Server.
455
- */
456
- UseAnotherServer = 156,
457
- /**
458
- * 0x9D - Server moved
459
- * Sent by: Server
460
- * Description: The Server is moved and the Client should permanently change its server location.
461
- */
462
- ServerMoved = 157,
463
- /**
464
- * 0x9E - Shared Subscriptions not supported
465
- * Sent by: Server
466
- * Description: The Server does not support Shared Subscriptions.
467
- */
468
- SharedSubscriptionsNotSupported = 158,
469
- /**
470
- * 0x9F - Connection rate exceeded
471
- * Sent by: Server
472
- * Description: This connection is closed because the connection rate is too high.
473
- */
474
- ConnectionRateExceeded = 159,
475
- /**
476
- * 0xA0 - Maximum connect time
477
- * Sent by: Server
478
- * Description: The maximum connection time authorized for this connection has been exceeded.
479
- */
480
- MaximumConnectTime = 160,
481
- /**
482
- * 0xA1 - Subscription Identifiers not supported
483
- * Sent by: Server
484
- * Description: The Server does not support Subscription Identifiers; the subscription is not accepted.
485
- */
486
- SubscriptionIdentifiersNotSupported = 161,
487
- /**
488
- * 0xA2 - Wildcard Subscriptions not supported
489
- * Sent by: Server
490
- * Description: The Server does not support Wildcard Subscriptions; the subscription is not accepted.
491
- */
492
- WildcardSubscriptionsNotSupported = 162
493
- }
494
-
495
- /**
496
- * The properties of a user in MQTT.
497
- */
498
- export declare interface MqttUserProperty {
499
- /**
500
- * The name of the property.
501
- */
502
- name: string;
503
- /**
504
- * The value of the property.
505
- */
506
- value: string;
507
- }
508
-
509
- /**
510
- * MQTT 3.1.1 Connect Return Codes.
511
- */
512
- export declare enum MqttV311ConnectReturnCode {
513
- /**
514
- * 0x01: Connection refused, unacceptable protocol version
515
- * The Server does not support the level of the MQTT protocol requested by the Client.
516
- */
517
- UnacceptableProtocolVersion = 1,
518
- /**
519
- * 0x02: Connection refused, identifier rejected
520
- * The Client identifier is correct UTF-8 but not allowed by the Server.
521
- */
522
- IdentifierRejected = 2,
523
- /**
524
- * 0x03: Connection refused, server unavailable
525
- * The Network Connection has been made but the MQTT service is unavailable.
526
- */
527
- ServerUnavailable = 3,
528
- /**
529
- * 0x04: Connection refused, bad user name or password
530
- * The data in the user name or password is malformed.
531
- */
532
- BadUsernameOrPassword = 4,
533
- /**
534
- * 0x05: Connection refused, not authorized
535
- * The Client is not authorized to connect.
536
- */
537
- NotAuthorized = 5
538
- }
539
-
540
- /**
541
- * MQTT Connect Reason Codes
542
- * These codes represent the reasons for the outcome of an MQTT CONNECT packet as per MQTT 5.0 specification.
543
- */
544
- export declare enum MqttV500ConnectReasonCode {
545
- /**
546
- * 0x80 - Unspecified error
547
- * Description: The Server does not wish to reveal the reason for the failure, or none of the other Reason Codes apply.
548
- */
549
- UnspecifiedError = 128,
550
- /**
551
- * 0x81 - Malformed Packet
552
- * Description: Data within the CONNECT packet could not be correctly parsed.
553
- */
554
- MalformedPacket = 129,
555
- /**
556
- * 0x82 - Protocol Error
557
- * Description: Data in the CONNECT packet does not conform to this specification.
558
- */
559
- ProtocolError = 130,
560
- /**
561
- * 0x83 - Implementation specific error
562
- * Description: The CONNECT is valid but is not accepted by this Server.
563
- */
564
- ImplementationSpecificError = 131,
565
- /**
566
- * 0x84 - Unsupported Protocol Version
567
- * Description: The Server does not support the version of the MQTT protocol requested by the Client.
568
- */
569
- UnsupportedProtocolVersion = 132,
570
- /**
571
- * 0x85 - Client Identifier not valid
572
- * Description: The Client Identifier is a valid string but is not allowed by the Server.
573
- */
574
- ClientIdentifierNotValid = 133,
575
- /**
576
- * 0x86 - Bad User Name or Password
577
- * Description: The Server does not accept the User Name or Password specified by the Client.
578
- */
579
- BadUserNameOrPassword = 134,
580
- /**
581
- * 0x87 - Not authorized
582
- * Description: The Client is not authorized to connect.
583
- */
584
- NotAuthorized = 135,
585
- /**
586
- * 0x88 - Server unavailable
587
- * Description: The MQTT Server is not available.
588
- */
589
- ServerUnavailable = 136,
590
- /**
591
- * 0x89 - Server busy
592
- * Description: The Server is busy. Try again later.
593
- */
594
- ServerBusy = 137,
595
- /**
596
- * 0x8A - Banned
597
- * Description: This Client has been banned by administrative action. Contact the server administrator.
598
- */
599
- Banned = 138,
600
- /**
601
- * 0x8C - Bad authentication method
602
- * Description: The authentication method is not supported or does not match the authentication method currently in use.
603
- */
604
- BadAuthenticationMethod = 140,
605
- /**
606
- * 0x90 - Topic Name invalid
607
- * Description: The Will Topic Name is not malformed, but is not accepted by this Server.
608
- */
609
- TopicNameInvalid = 144,
610
- /**
611
- * 0x95 - Packet too large
612
- * Description: The CONNECT packet exceeded the maximum permissible size.
613
- */
614
- PacketTooLarge = 149,
615
- /**
616
- * 0x97 - Quota exceeded
617
- * Description: An implementation or administrative imposed limit has been exceeded.
618
- */
619
- QuotaExceeded = 151,
620
- /**
621
- * 0x99 - Payload format invalid
622
- * Description: The Will Payload does not match the specified Payload Format Indicator.
623
- */
624
- PayloadFormatInvalid = 153,
625
- /**
626
- * 0x9A - Retain not supported
627
- * Description: The Server does not support retained messages, and Will Retain was set to 1.
628
- */
629
- RetainNotSupported = 154,
630
- /**
631
- * 0x9B - QoS not supported
632
- * Description: The Server does not support the QoS set in Will QoS.
633
- */
634
- QosNotSupported = 155,
635
- /**
636
- * 0x9C - Use another server
637
- * Description: The Client should temporarily use another server.
638
- */
639
- UseAnotherServer = 156,
640
- /**
641
- * 0x9D - Server moved
642
- * Description: The Client should permanently use another server.
643
- */
644
- ServerMoved = 157,
645
- /**
646
- * 0x9F - Connection rate exceeded
647
- * Description: The connection rate limit has been exceeded.
648
- */
649
- ConnectionRateExceeded = 159
650
- }
651
-
652
- /**
653
- * Request for the user event.
654
- */
655
- export declare type UserEventRequest = {
656
- /**
657
- * The context of current CloudEvents request.
658
- */
659
- context: ConnectionContext;
660
- /**
661
- * The content data.
662
- */
663
- data: string;
664
- /**
665
- * The type of the data.
666
- */
667
- dataType: "text";
668
- } | {
669
- /**
670
- * The context of current CloudEvents request.
671
- */
672
- context: ConnectionContext;
673
- /**
674
- * The content data, when data type is `json`, the data is the result of JSON.parse, so the type of the data depends on user scenarios
675
- */
676
- data: unknown;
677
- /**
678
- * The type of the data.
679
- */
680
- dataType: "json";
681
- } | {
682
- /**
683
- * The context of current CloudEvents request.
684
- */
685
- context: ConnectionContext;
686
- /**
687
- * The content data.
688
- */
689
- data: ArrayBuffer;
690
- /**
691
- * The type of the data.
692
- */
693
- dataType: "binary";
694
- };
695
-
696
- /**
697
- * The handler to set user event response
698
- */
699
- export declare interface UserEventResponseHandler {
700
- /**
701
- * Set the state of the connection
702
- * @param name - The name of the state
703
- * @param value - The value of the state
704
- */
705
- setState(name: string, value: unknown): void;
706
- /**
707
- * Return success response with data to be delivered to the client WebSocket connection.
708
- * @param data - The payload data to be returned to the client. Stringify the message if it is a JSON object.
709
- * @param dataType - The type of the payload data.
710
- */
711
- success(data?: string | ArrayBuffer, dataType?: "binary" | "text" | "json"): void;
712
- /**
713
- * Return failed response and the service will close the client WebSocket connection.
714
- * @param code - Code can be 400 user error, 401 unauthorized and 500 server error.
715
- * @param detail - The detail of the error.
716
- */
717
- fail(code: 400 | 401 | 500, detail?: string): void;
718
- }
719
-
720
- /**
721
- * The protocol of Web PubSub Client.
722
- */
723
- export declare type WebPubSubClientProtocol = "default" | "mqtt";
724
-
725
- /**
726
- * The handler to handle incoming CloudEvents messages
727
- */
728
- export declare class WebPubSubEventHandler {
729
- private hub;
730
- /**
731
- * The path this CloudEvents handler listens to
732
- */
733
- readonly path: string;
734
- private _cloudEventsHandler;
735
- /**
736
- * Creates an instance of a WebPubSubEventHandler for handling incoming CloudEvents messages.
737
- *
738
- * Example usage:
739
- * ```ts
740
- * import express from "express";
741
- * import { WebPubSubEventHandler } from "@azure/web-pubsub-express";
742
- * const endpoint = "https://xxxx.webpubsubdev.azure.com"
743
- * const handler = new WebPubSubEventHandler('chat', {
744
- * handleConnect: (req, res) => {
745
- * console.log(JSON.stringify(req));
746
- * return {};
747
- * },
748
- * onConnected: req => {
749
- * console.log(JSON.stringify(req));
750
- * },
751
- * handleUserEvent: (req, res) => {
752
- * console.log(JSON.stringify(req));
753
- * res.success("Hey " + req.data, req.dataType);
754
- * };
755
- * allowedEndpoints: [ endpoint ]
756
- * },
757
- * });
758
- * ```
759
- *
760
- * @param hub - The name of the hub to listen to
761
- * @param options - Options to configure the event handler
762
- */
763
- constructor(hub: string, options?: WebPubSubEventHandlerOptions);
764
- /**
765
- * Get the middleware to process the CloudEvents requests
766
- */
767
- getMiddleware(): express.RequestHandler;
768
- }
769
-
770
- /**
771
- * The options for the CloudEvents handler.
772
- */
773
- export declare interface WebPubSubEventHandlerOptions {
774
- /**
775
- * Custom serving path for the path of the CloudEvents handler.
776
- */
777
- path?: string;
778
- /**
779
- * Handle 'connect' event, the service waits for the response to proceed.
780
- */
781
- handleConnect?: (connectRequest: ConnectRequest, connectResponse: ConnectResponseHandler) => void;
782
- /**
783
- * Handle user events, the service waits for the response to proceed.
784
- */
785
- handleUserEvent?: (userEventRequest: UserEventRequest, userEventResponse: UserEventResponseHandler) => void;
786
- /**
787
- * Event trigger for "connected" unblocking event. This is an unblocking event and the service does not wait for the response.
788
- */
789
- onConnected?: (connectedRequest: ConnectedRequest) => void;
790
- /**
791
- *
792
- * Event triggers for "disconnected" unblocking event. This is an unblocking event and the service does not wait for the response.
793
- */
794
- onDisconnected?: (disconnectedRequest: DisconnectedRequest) => void;
795
- /**
796
- * If not specified, by default allow all the endpoints, otherwise only allow specified endpoints
797
- */
798
- allowedEndpoints?: string[];
799
- }
800
-
801
- export { }