@vercel/functions 3.6.3 → 3.7.0

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.
@@ -0,0 +1,2187 @@
1
+ [**@vercel/functions**](../../README.md)
2
+
3
+ ***
4
+
5
+ # Interface: WebSocket
6
+
7
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:438
8
+
9
+ ## Extends
10
+
11
+ - `WebSocketAlias`
12
+
13
+ ## Properties
14
+
15
+ ### binaryType
16
+
17
+ > **binaryType**: `"nodebuffer"` \| `"arraybuffer"` \| `"fragments"`
18
+
19
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:51
20
+
21
+ #### Inherited from
22
+
23
+ `WebSocketAlias.binaryType`
24
+
25
+ ***
26
+
27
+ ### bufferedAmount
28
+
29
+ > `readonly` **bufferedAmount**: `number`
30
+
31
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:52
32
+
33
+ #### Inherited from
34
+
35
+ `WebSocketAlias.bufferedAmount`
36
+
37
+ ***
38
+
39
+ ### CLOSED
40
+
41
+ > `readonly` **CLOSED**: `3`
42
+
43
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:72
44
+
45
+ The connection is closed.
46
+
47
+ #### Inherited from
48
+
49
+ `WebSocketAlias.CLOSED`
50
+
51
+ ***
52
+
53
+ ### CLOSING
54
+
55
+ > `readonly` **CLOSING**: `2`
56
+
57
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:70
58
+
59
+ The connection is in the process of closing.
60
+
61
+ #### Inherited from
62
+
63
+ `WebSocketAlias.CLOSING`
64
+
65
+ ***
66
+
67
+ ### CONNECTING
68
+
69
+ > `readonly` **CONNECTING**: `0`
70
+
71
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:66
72
+
73
+ The connection is not yet open.
74
+
75
+ #### Inherited from
76
+
77
+ `WebSocketAlias.CONNECTING`
78
+
79
+ ***
80
+
81
+ ### extensions
82
+
83
+ > `readonly` **extensions**: `string`
84
+
85
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:53
86
+
87
+ #### Inherited from
88
+
89
+ `WebSocketAlias.extensions`
90
+
91
+ ***
92
+
93
+ ### isPaused
94
+
95
+ > `readonly` **isPaused**: `boolean`
96
+
97
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:55
98
+
99
+ Indicates whether the websocket is paused
100
+
101
+ #### Inherited from
102
+
103
+ `WebSocketAlias.isPaused`
104
+
105
+ ***
106
+
107
+ ### onclose
108
+
109
+ > **onclose**: ((`event`) => `void`) \| `null`
110
+
111
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:76
112
+
113
+ #### Inherited from
114
+
115
+ `WebSocketAlias.onclose`
116
+
117
+ ***
118
+
119
+ ### onerror
120
+
121
+ > **onerror**: ((`event`) => `void`) \| `null`
122
+
123
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:75
124
+
125
+ #### Inherited from
126
+
127
+ `WebSocketAlias.onerror`
128
+
129
+ ***
130
+
131
+ ### onmessage
132
+
133
+ > **onmessage**: ((`event`) => `void`) \| `null`
134
+
135
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:77
136
+
137
+ #### Inherited from
138
+
139
+ `WebSocketAlias.onmessage`
140
+
141
+ ***
142
+
143
+ ### onopen
144
+
145
+ > **onopen**: ((`event`) => `void`) \| `null`
146
+
147
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:74
148
+
149
+ #### Inherited from
150
+
151
+ `WebSocketAlias.onopen`
152
+
153
+ ***
154
+
155
+ ### OPEN
156
+
157
+ > `readonly` **OPEN**: `1`
158
+
159
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:68
160
+
161
+ The connection is open and ready to communicate.
162
+
163
+ #### Inherited from
164
+
165
+ `WebSocketAlias.OPEN`
166
+
167
+ ***
168
+
169
+ ### protocol
170
+
171
+ > `readonly` **protocol**: `string`
172
+
173
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:56
174
+
175
+ #### Inherited from
176
+
177
+ `WebSocketAlias.protocol`
178
+
179
+ ***
180
+
181
+ ### readyState
182
+
183
+ > `readonly` **readyState**: `0` \| `1` \| `2` \| `3`
184
+
185
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:58
186
+
187
+ The current state of the connection
188
+
189
+ #### Inherited from
190
+
191
+ `WebSocketAlias.readyState`
192
+
193
+ ***
194
+
195
+ ### url
196
+
197
+ > `readonly` **url**: `string`
198
+
199
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:63
200
+
201
+ #### Inherited from
202
+
203
+ `WebSocketAlias.url`
204
+
205
+ ## Methods
206
+
207
+ ### \[captureRejectionSymbol\]()?
208
+
209
+ > `optional` **\[captureRejectionSymbol\]**(`error`, `event`, ...`args`): `void`
210
+
211
+ Defined in: node\_modules/.pnpm/@types+node@20.11.0/node\_modules/@types/node/events.d.ts:112
212
+
213
+ #### Parameters
214
+
215
+ ##### error
216
+
217
+ [`Error`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)
218
+
219
+ ##### event
220
+
221
+ `string`
222
+
223
+ ##### args
224
+
225
+ ...`any`[]
226
+
227
+ #### Returns
228
+
229
+ `void`
230
+
231
+ #### Inherited from
232
+
233
+ `WebSocketAlias.[captureRejectionSymbol]`
234
+
235
+ ***
236
+
237
+ ### addEventListener()
238
+
239
+ > **addEventListener**\<`K`\>(`type`, `listener`, `options?`): `void`
240
+
241
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:117
242
+
243
+ #### Type Parameters
244
+
245
+ ##### K
246
+
247
+ `K` *extends* keyof `WebSocketEventMap`
248
+
249
+ #### Parameters
250
+
251
+ ##### type
252
+
253
+ `K`
254
+
255
+ ##### listener
256
+
257
+ ((`event`) => `void`) \| \{ `handleEvent`: `void`; \}
258
+
259
+ ##### options?
260
+
261
+ `EventListenerOptions`
262
+
263
+ #### Returns
264
+
265
+ `void`
266
+
267
+ #### Inherited from
268
+
269
+ `WebSocketAlias.addEventListener`
270
+
271
+ ***
272
+
273
+ ### addListener()
274
+
275
+ #### Call Signature
276
+
277
+ > **addListener**(`event`, `listener`): `this`
278
+
279
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:171
280
+
281
+ Alias for `emitter.on(eventName, listener)`.
282
+
283
+ ##### Parameters
284
+
285
+ ###### event
286
+
287
+ `"close"`
288
+
289
+ ###### listener
290
+
291
+ (`code`, `reason`) => `void`
292
+
293
+ ##### Returns
294
+
295
+ `this`
296
+
297
+ ##### Since
298
+
299
+ v0.1.26
300
+
301
+ ##### Inherited from
302
+
303
+ `WebSocketAlias.addListener`
304
+
305
+ #### Call Signature
306
+
307
+ > **addListener**(`event`, `listener`): `this`
308
+
309
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:172
310
+
311
+ ##### Parameters
312
+
313
+ ###### event
314
+
315
+ `"error"`
316
+
317
+ ###### listener
318
+
319
+ (`error`) => `void`
320
+
321
+ ##### Returns
322
+
323
+ `this`
324
+
325
+ ##### Inherited from
326
+
327
+ `WebSocketAlias.addListener`
328
+
329
+ #### Call Signature
330
+
331
+ > **addListener**(`event`, `listener`): `this`
332
+
333
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:173
334
+
335
+ ##### Parameters
336
+
337
+ ###### event
338
+
339
+ `"upgrade"`
340
+
341
+ ###### listener
342
+
343
+ (`request`) => `void`
344
+
345
+ ##### Returns
346
+
347
+ `this`
348
+
349
+ ##### Inherited from
350
+
351
+ `WebSocketAlias.addListener`
352
+
353
+ #### Call Signature
354
+
355
+ > **addListener**(`event`, `listener`): `this`
356
+
357
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:174
358
+
359
+ ##### Parameters
360
+
361
+ ###### event
362
+
363
+ `"message"`
364
+
365
+ ###### listener
366
+
367
+ (`data`, `isBinary`) => `void`
368
+
369
+ ##### Returns
370
+
371
+ `this`
372
+
373
+ ##### Inherited from
374
+
375
+ `WebSocketAlias.addListener`
376
+
377
+ #### Call Signature
378
+
379
+ > **addListener**(`event`, `listener`): `this`
380
+
381
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:175
382
+
383
+ ##### Parameters
384
+
385
+ ###### event
386
+
387
+ `"open"`
388
+
389
+ ###### listener
390
+
391
+ () => `void`
392
+
393
+ ##### Returns
394
+
395
+ `this`
396
+
397
+ ##### Inherited from
398
+
399
+ `WebSocketAlias.addListener`
400
+
401
+ #### Call Signature
402
+
403
+ > **addListener**(`event`, `listener`): `this`
404
+
405
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:176
406
+
407
+ ##### Parameters
408
+
409
+ ###### event
410
+
411
+ `"ping"` \| `"pong"`
412
+
413
+ ###### listener
414
+
415
+ (`data`) => `void`
416
+
417
+ ##### Returns
418
+
419
+ `this`
420
+
421
+ ##### Inherited from
422
+
423
+ `WebSocketAlias.addListener`
424
+
425
+ #### Call Signature
426
+
427
+ > **addListener**(`event`, `listener`): `this`
428
+
429
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:177
430
+
431
+ ##### Parameters
432
+
433
+ ###### event
434
+
435
+ `"redirect"`
436
+
437
+ ###### listener
438
+
439
+ (`url`, `request`) => `void`
440
+
441
+ ##### Returns
442
+
443
+ `this`
444
+
445
+ ##### Inherited from
446
+
447
+ `WebSocketAlias.addListener`
448
+
449
+ #### Call Signature
450
+
451
+ > **addListener**(`event`, `listener`): `this`
452
+
453
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:178
454
+
455
+ ##### Parameters
456
+
457
+ ###### event
458
+
459
+ `"unexpected-response"`
460
+
461
+ ###### listener
462
+
463
+ (`request`, `response`) => `void`
464
+
465
+ ##### Returns
466
+
467
+ `this`
468
+
469
+ ##### Inherited from
470
+
471
+ `WebSocketAlias.addListener`
472
+
473
+ #### Call Signature
474
+
475
+ > **addListener**(`event`, `listener`): `this`
476
+
477
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:182
478
+
479
+ ##### Parameters
480
+
481
+ ###### event
482
+
483
+ `string` \| `symbol`
484
+
485
+ ###### listener
486
+
487
+ (...`args`) => `void`
488
+
489
+ ##### Returns
490
+
491
+ `this`
492
+
493
+ ##### Inherited from
494
+
495
+ `WebSocketAlias.addListener`
496
+
497
+ ***
498
+
499
+ ### close()
500
+
501
+ > **close**(`code?`, `data?`): `void`
502
+
503
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:87
504
+
505
+ #### Parameters
506
+
507
+ ##### code?
508
+
509
+ `number`
510
+
511
+ ##### data?
512
+
513
+ `string` \| `Buffer`
514
+
515
+ #### Returns
516
+
517
+ `void`
518
+
519
+ #### Inherited from
520
+
521
+ `WebSocketAlias.close`
522
+
523
+ ***
524
+
525
+ ### emit()
526
+
527
+ > **emit**(`eventName`, ...`args`): `boolean`
528
+
529
+ Defined in: node\_modules/.pnpm/@types+node@20.11.0/node\_modules/@types/node/events.d.ts:807
530
+
531
+ Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments
532
+ to each.
533
+
534
+ Returns `true` if the event had listeners, `false` otherwise.
535
+
536
+ ```js
537
+ import { EventEmitter } from 'node:events';
538
+ const myEmitter = new EventEmitter();
539
+
540
+ // First listener
541
+ myEmitter.on('event', function firstListener() {
542
+ console.log('Helloooo! first listener');
543
+ });
544
+ // Second listener
545
+ myEmitter.on('event', function secondListener(arg1, arg2) {
546
+ console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
547
+ });
548
+ // Third listener
549
+ myEmitter.on('event', function thirdListener(...args) {
550
+ const parameters = args.join(', ');
551
+ console.log(`event with parameters ${parameters} in third listener`);
552
+ });
553
+
554
+ console.log(myEmitter.listeners('event'));
555
+
556
+ myEmitter.emit('event', 1, 2, 3, 4, 5);
557
+
558
+ // Prints:
559
+ // [
560
+ // [Function: firstListener],
561
+ // [Function: secondListener],
562
+ // [Function: thirdListener]
563
+ // ]
564
+ // Helloooo! first listener
565
+ // event with parameters 1, 2 in second listener
566
+ // event with parameters 1, 2, 3, 4, 5 in third listener
567
+ ```
568
+
569
+ #### Parameters
570
+
571
+ ##### eventName
572
+
573
+ `string` \| `symbol`
574
+
575
+ ##### args
576
+
577
+ ...`any`[]
578
+
579
+ #### Returns
580
+
581
+ `boolean`
582
+
583
+ #### Since
584
+
585
+ v0.1.26
586
+
587
+ #### Inherited from
588
+
589
+ `WebSocketAlias.emit`
590
+
591
+ ***
592
+
593
+ ### eventNames()
594
+
595
+ > **eventNames**(): (`string` \| `symbol`)[]
596
+
597
+ Defined in: node\_modules/.pnpm/@types+node@20.11.0/node\_modules/@types/node/events.d.ts:870
598
+
599
+ Returns an array listing the events for which the emitter has registered
600
+ listeners. The values in the array are strings or `Symbol`s.
601
+
602
+ ```js
603
+ import { EventEmitter } from 'node:events';
604
+
605
+ const myEE = new EventEmitter();
606
+ myEE.on('foo', () => {});
607
+ myEE.on('bar', () => {});
608
+
609
+ const sym = Symbol('symbol');
610
+ myEE.on(sym, () => {});
611
+
612
+ console.log(myEE.eventNames());
613
+ // Prints: [ 'foo', 'bar', Symbol(symbol) ]
614
+ ```
615
+
616
+ #### Returns
617
+
618
+ (`string` \| `symbol`)[]
619
+
620
+ #### Since
621
+
622
+ v6.0.0
623
+
624
+ #### Inherited from
625
+
626
+ `WebSocketAlias.eventNames`
627
+
628
+ ***
629
+
630
+ ### getMaxListeners()
631
+
632
+ > **getMaxListeners**(): `number`
633
+
634
+ Defined in: node\_modules/.pnpm/@types+node@20.11.0/node\_modules/@types/node/events.d.ts:722
635
+
636
+ Returns the current max listener value for the `EventEmitter` which is either
637
+ set by `emitter.setMaxListeners(n)` or defaults to defaultMaxListeners.
638
+
639
+ #### Returns
640
+
641
+ `number`
642
+
643
+ #### Since
644
+
645
+ v1.0.0
646
+
647
+ #### Inherited from
648
+
649
+ `WebSocketAlias.getMaxListeners`
650
+
651
+ ***
652
+
653
+ ### listenerCount()
654
+
655
+ > **listenerCount**(`eventName`, `listener?`): `number`
656
+
657
+ Defined in: node\_modules/.pnpm/@types+node@20.11.0/node\_modules/@types/node/events.d.ts:816
658
+
659
+ Returns the number of listeners listening for the event named `eventName`.
660
+ If `listener` is provided, it will return how many times the listener is found
661
+ in the list of the listeners of the event.
662
+
663
+ #### Parameters
664
+
665
+ ##### eventName
666
+
667
+ `string` \| `symbol`
668
+
669
+ The name of the event being listened for
670
+
671
+ ##### listener?
672
+
673
+ [`Function`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function)
674
+
675
+ The event handler function
676
+
677
+ #### Returns
678
+
679
+ `number`
680
+
681
+ #### Since
682
+
683
+ v3.2.0
684
+
685
+ #### Inherited from
686
+
687
+ `WebSocketAlias.listenerCount`
688
+
689
+ ***
690
+
691
+ ### listeners()
692
+
693
+ > **listeners**(`eventName`): [`Function`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function)[]
694
+
695
+ Defined in: node\_modules/.pnpm/@types+node@20.11.0/node\_modules/@types/node/events.d.ts:735
696
+
697
+ Returns a copy of the array of listeners for the event named `eventName`.
698
+
699
+ ```js
700
+ server.on('connection', (stream) => {
701
+ console.log('someone connected!');
702
+ });
703
+ console.log(util.inspect(server.listeners('connection')));
704
+ // Prints: [ [Function] ]
705
+ ```
706
+
707
+ #### Parameters
708
+
709
+ ##### eventName
710
+
711
+ `string` \| `symbol`
712
+
713
+ #### Returns
714
+
715
+ [`Function`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function)[]
716
+
717
+ #### Since
718
+
719
+ v0.1.26
720
+
721
+ #### Inherited from
722
+
723
+ `WebSocketAlias.listeners`
724
+
725
+ ***
726
+
727
+ ### off()
728
+
729
+ #### Call Signature
730
+
731
+ > **off**(`event`, `listener`): `this`
732
+
733
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:158
734
+
735
+ Alias for `emitter.removeListener()`.
736
+
737
+ ##### Parameters
738
+
739
+ ###### event
740
+
741
+ `"close"`
742
+
743
+ ###### listener
744
+
745
+ (`this`, `code`, `reason`) => `void`
746
+
747
+ ##### Returns
748
+
749
+ `this`
750
+
751
+ ##### Since
752
+
753
+ v10.0.0
754
+
755
+ ##### Inherited from
756
+
757
+ `WebSocketAlias.off`
758
+
759
+ #### Call Signature
760
+
761
+ > **off**(`event`, `listener`): `this`
762
+
763
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:159
764
+
765
+ ##### Parameters
766
+
767
+ ###### event
768
+
769
+ `"error"`
770
+
771
+ ###### listener
772
+
773
+ (`this`, `error`) => `void`
774
+
775
+ ##### Returns
776
+
777
+ `this`
778
+
779
+ ##### Inherited from
780
+
781
+ `WebSocketAlias.off`
782
+
783
+ #### Call Signature
784
+
785
+ > **off**(`event`, `listener`): `this`
786
+
787
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:160
788
+
789
+ ##### Parameters
790
+
791
+ ###### event
792
+
793
+ `"upgrade"`
794
+
795
+ ###### listener
796
+
797
+ (`this`, `request`) => `void`
798
+
799
+ ##### Returns
800
+
801
+ `this`
802
+
803
+ ##### Inherited from
804
+
805
+ `WebSocketAlias.off`
806
+
807
+ #### Call Signature
808
+
809
+ > **off**(`event`, `listener`): `this`
810
+
811
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:161
812
+
813
+ ##### Parameters
814
+
815
+ ###### event
816
+
817
+ `"message"`
818
+
819
+ ###### listener
820
+
821
+ (`this`, `data`, `isBinary`) => `void`
822
+
823
+ ##### Returns
824
+
825
+ `this`
826
+
827
+ ##### Inherited from
828
+
829
+ `WebSocketAlias.off`
830
+
831
+ #### Call Signature
832
+
833
+ > **off**(`event`, `listener`): `this`
834
+
835
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:162
836
+
837
+ ##### Parameters
838
+
839
+ ###### event
840
+
841
+ `"open"`
842
+
843
+ ###### listener
844
+
845
+ (`this`) => `void`
846
+
847
+ ##### Returns
848
+
849
+ `this`
850
+
851
+ ##### Inherited from
852
+
853
+ `WebSocketAlias.off`
854
+
855
+ #### Call Signature
856
+
857
+ > **off**(`event`, `listener`): `this`
858
+
859
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:163
860
+
861
+ ##### Parameters
862
+
863
+ ###### event
864
+
865
+ `"ping"` \| `"pong"`
866
+
867
+ ###### listener
868
+
869
+ (`this`, `data`) => `void`
870
+
871
+ ##### Returns
872
+
873
+ `this`
874
+
875
+ ##### Inherited from
876
+
877
+ `WebSocketAlias.off`
878
+
879
+ #### Call Signature
880
+
881
+ > **off**(`event`, `listener`): `this`
882
+
883
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:164
884
+
885
+ ##### Parameters
886
+
887
+ ###### event
888
+
889
+ `"redirect"`
890
+
891
+ ###### listener
892
+
893
+ (`this`, `url`, `request`) => `void`
894
+
895
+ ##### Returns
896
+
897
+ `this`
898
+
899
+ ##### Inherited from
900
+
901
+ `WebSocketAlias.off`
902
+
903
+ #### Call Signature
904
+
905
+ > **off**(`event`, `listener`): `this`
906
+
907
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:165
908
+
909
+ ##### Parameters
910
+
911
+ ###### event
912
+
913
+ `"unexpected-response"`
914
+
915
+ ###### listener
916
+
917
+ (`this`, `request`, `response`) => `void`
918
+
919
+ ##### Returns
920
+
921
+ `this`
922
+
923
+ ##### Inherited from
924
+
925
+ `WebSocketAlias.off`
926
+
927
+ #### Call Signature
928
+
929
+ > **off**(`event`, `listener`): `this`
930
+
931
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:169
932
+
933
+ ##### Parameters
934
+
935
+ ###### event
936
+
937
+ `string` \| `symbol`
938
+
939
+ ###### listener
940
+
941
+ (`this`, ...`args`) => `void`
942
+
943
+ ##### Returns
944
+
945
+ `this`
946
+
947
+ ##### Inherited from
948
+
949
+ `WebSocketAlias.off`
950
+
951
+ ***
952
+
953
+ ### on()
954
+
955
+ #### Call Signature
956
+
957
+ > **on**(`event`, `listener`): `this`
958
+
959
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:132
960
+
961
+ Adds the `listener` function to the end of the listeners array for the
962
+ event named `eventName`. No checks are made to see if the `listener` has
963
+ already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
964
+ times.
965
+
966
+ ```js
967
+ server.on('connection', (stream) => {
968
+ console.log('someone connected!');
969
+ });
970
+ ```
971
+
972
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
973
+
974
+ By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the
975
+ event listener to the beginning of the listeners array.
976
+
977
+ ```js
978
+ import { EventEmitter } from 'node:events';
979
+ const myEE = new EventEmitter();
980
+ myEE.on('foo', () => console.log('a'));
981
+ myEE.prependListener('foo', () => console.log('b'));
982
+ myEE.emit('foo');
983
+ // Prints:
984
+ // b
985
+ // a
986
+ ```
987
+
988
+ ##### Parameters
989
+
990
+ ###### event
991
+
992
+ `"close"`
993
+
994
+ ###### listener
995
+
996
+ (`this`, `code`, `reason`) => `void`
997
+
998
+ The callback function
999
+
1000
+ ##### Returns
1001
+
1002
+ `this`
1003
+
1004
+ ##### Since
1005
+
1006
+ v0.1.101
1007
+
1008
+ ##### Inherited from
1009
+
1010
+ `WebSocketAlias.on`
1011
+
1012
+ #### Call Signature
1013
+
1014
+ > **on**(`event`, `listener`): `this`
1015
+
1016
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:133
1017
+
1018
+ ##### Parameters
1019
+
1020
+ ###### event
1021
+
1022
+ `"error"`
1023
+
1024
+ ###### listener
1025
+
1026
+ (`this`, `error`) => `void`
1027
+
1028
+ ##### Returns
1029
+
1030
+ `this`
1031
+
1032
+ ##### Inherited from
1033
+
1034
+ `WebSocketAlias.on`
1035
+
1036
+ #### Call Signature
1037
+
1038
+ > **on**(`event`, `listener`): `this`
1039
+
1040
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:134
1041
+
1042
+ ##### Parameters
1043
+
1044
+ ###### event
1045
+
1046
+ `"upgrade"`
1047
+
1048
+ ###### listener
1049
+
1050
+ (`this`, `request`) => `void`
1051
+
1052
+ ##### Returns
1053
+
1054
+ `this`
1055
+
1056
+ ##### Inherited from
1057
+
1058
+ `WebSocketAlias.on`
1059
+
1060
+ #### Call Signature
1061
+
1062
+ > **on**(`event`, `listener`): `this`
1063
+
1064
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:135
1065
+
1066
+ ##### Parameters
1067
+
1068
+ ###### event
1069
+
1070
+ `"message"`
1071
+
1072
+ ###### listener
1073
+
1074
+ (`this`, `data`, `isBinary`) => `void`
1075
+
1076
+ ##### Returns
1077
+
1078
+ `this`
1079
+
1080
+ ##### Inherited from
1081
+
1082
+ `WebSocketAlias.on`
1083
+
1084
+ #### Call Signature
1085
+
1086
+ > **on**(`event`, `listener`): `this`
1087
+
1088
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:136
1089
+
1090
+ ##### Parameters
1091
+
1092
+ ###### event
1093
+
1094
+ `"open"`
1095
+
1096
+ ###### listener
1097
+
1098
+ (`this`) => `void`
1099
+
1100
+ ##### Returns
1101
+
1102
+ `this`
1103
+
1104
+ ##### Inherited from
1105
+
1106
+ `WebSocketAlias.on`
1107
+
1108
+ #### Call Signature
1109
+
1110
+ > **on**(`event`, `listener`): `this`
1111
+
1112
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:137
1113
+
1114
+ ##### Parameters
1115
+
1116
+ ###### event
1117
+
1118
+ `"ping"` \| `"pong"`
1119
+
1120
+ ###### listener
1121
+
1122
+ (`this`, `data`) => `void`
1123
+
1124
+ ##### Returns
1125
+
1126
+ `this`
1127
+
1128
+ ##### Inherited from
1129
+
1130
+ `WebSocketAlias.on`
1131
+
1132
+ #### Call Signature
1133
+
1134
+ > **on**(`event`, `listener`): `this`
1135
+
1136
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:138
1137
+
1138
+ ##### Parameters
1139
+
1140
+ ###### event
1141
+
1142
+ `"redirect"`
1143
+
1144
+ ###### listener
1145
+
1146
+ (`this`, `url`, `request`) => `void`
1147
+
1148
+ ##### Returns
1149
+
1150
+ `this`
1151
+
1152
+ ##### Inherited from
1153
+
1154
+ `WebSocketAlias.on`
1155
+
1156
+ #### Call Signature
1157
+
1158
+ > **on**(`event`, `listener`): `this`
1159
+
1160
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:139
1161
+
1162
+ ##### Parameters
1163
+
1164
+ ###### event
1165
+
1166
+ `"unexpected-response"`
1167
+
1168
+ ###### listener
1169
+
1170
+ (`this`, `request`, `response`) => `void`
1171
+
1172
+ ##### Returns
1173
+
1174
+ `this`
1175
+
1176
+ ##### Inherited from
1177
+
1178
+ `WebSocketAlias.on`
1179
+
1180
+ #### Call Signature
1181
+
1182
+ > **on**(`event`, `listener`): `this`
1183
+
1184
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:143
1185
+
1186
+ ##### Parameters
1187
+
1188
+ ###### event
1189
+
1190
+ `string` \| `symbol`
1191
+
1192
+ ###### listener
1193
+
1194
+ (`this`, ...`args`) => `void`
1195
+
1196
+ ##### Returns
1197
+
1198
+ `this`
1199
+
1200
+ ##### Inherited from
1201
+
1202
+ `WebSocketAlias.on`
1203
+
1204
+ ***
1205
+
1206
+ ### once()
1207
+
1208
+ #### Call Signature
1209
+
1210
+ > **once**(`event`, `listener`): `this`
1211
+
1212
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:145
1213
+
1214
+ Adds a **one-time**`listener` function for the event named `eventName`. The
1215
+ next time `eventName` is triggered, this listener is removed and then invoked.
1216
+
1217
+ ```js
1218
+ server.once('connection', (stream) => {
1219
+ console.log('Ah, we have our first user!');
1220
+ });
1221
+ ```
1222
+
1223
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
1224
+
1225
+ By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the
1226
+ event listener to the beginning of the listeners array.
1227
+
1228
+ ```js
1229
+ import { EventEmitter } from 'node:events';
1230
+ const myEE = new EventEmitter();
1231
+ myEE.once('foo', () => console.log('a'));
1232
+ myEE.prependOnceListener('foo', () => console.log('b'));
1233
+ myEE.emit('foo');
1234
+ // Prints:
1235
+ // b
1236
+ // a
1237
+ ```
1238
+
1239
+ ##### Parameters
1240
+
1241
+ ###### event
1242
+
1243
+ `"close"`
1244
+
1245
+ ###### listener
1246
+
1247
+ (`this`, `code`, `reason`) => `void`
1248
+
1249
+ The callback function
1250
+
1251
+ ##### Returns
1252
+
1253
+ `this`
1254
+
1255
+ ##### Since
1256
+
1257
+ v0.3.0
1258
+
1259
+ ##### Inherited from
1260
+
1261
+ `WebSocketAlias.once`
1262
+
1263
+ #### Call Signature
1264
+
1265
+ > **once**(`event`, `listener`): `this`
1266
+
1267
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:146
1268
+
1269
+ ##### Parameters
1270
+
1271
+ ###### event
1272
+
1273
+ `"error"`
1274
+
1275
+ ###### listener
1276
+
1277
+ (`this`, `error`) => `void`
1278
+
1279
+ ##### Returns
1280
+
1281
+ `this`
1282
+
1283
+ ##### Inherited from
1284
+
1285
+ `WebSocketAlias.once`
1286
+
1287
+ #### Call Signature
1288
+
1289
+ > **once**(`event`, `listener`): `this`
1290
+
1291
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:147
1292
+
1293
+ ##### Parameters
1294
+
1295
+ ###### event
1296
+
1297
+ `"upgrade"`
1298
+
1299
+ ###### listener
1300
+
1301
+ (`this`, `request`) => `void`
1302
+
1303
+ ##### Returns
1304
+
1305
+ `this`
1306
+
1307
+ ##### Inherited from
1308
+
1309
+ `WebSocketAlias.once`
1310
+
1311
+ #### Call Signature
1312
+
1313
+ > **once**(`event`, `listener`): `this`
1314
+
1315
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:148
1316
+
1317
+ ##### Parameters
1318
+
1319
+ ###### event
1320
+
1321
+ `"message"`
1322
+
1323
+ ###### listener
1324
+
1325
+ (`this`, `data`, `isBinary`) => `void`
1326
+
1327
+ ##### Returns
1328
+
1329
+ `this`
1330
+
1331
+ ##### Inherited from
1332
+
1333
+ `WebSocketAlias.once`
1334
+
1335
+ #### Call Signature
1336
+
1337
+ > **once**(`event`, `listener`): `this`
1338
+
1339
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:149
1340
+
1341
+ ##### Parameters
1342
+
1343
+ ###### event
1344
+
1345
+ `"open"`
1346
+
1347
+ ###### listener
1348
+
1349
+ (`this`) => `void`
1350
+
1351
+ ##### Returns
1352
+
1353
+ `this`
1354
+
1355
+ ##### Inherited from
1356
+
1357
+ `WebSocketAlias.once`
1358
+
1359
+ #### Call Signature
1360
+
1361
+ > **once**(`event`, `listener`): `this`
1362
+
1363
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:150
1364
+
1365
+ ##### Parameters
1366
+
1367
+ ###### event
1368
+
1369
+ `"ping"` \| `"pong"`
1370
+
1371
+ ###### listener
1372
+
1373
+ (`this`, `data`) => `void`
1374
+
1375
+ ##### Returns
1376
+
1377
+ `this`
1378
+
1379
+ ##### Inherited from
1380
+
1381
+ `WebSocketAlias.once`
1382
+
1383
+ #### Call Signature
1384
+
1385
+ > **once**(`event`, `listener`): `this`
1386
+
1387
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:151
1388
+
1389
+ ##### Parameters
1390
+
1391
+ ###### event
1392
+
1393
+ `"redirect"`
1394
+
1395
+ ###### listener
1396
+
1397
+ (`this`, `url`, `request`) => `void`
1398
+
1399
+ ##### Returns
1400
+
1401
+ `this`
1402
+
1403
+ ##### Inherited from
1404
+
1405
+ `WebSocketAlias.once`
1406
+
1407
+ #### Call Signature
1408
+
1409
+ > **once**(`event`, `listener`): `this`
1410
+
1411
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:152
1412
+
1413
+ ##### Parameters
1414
+
1415
+ ###### event
1416
+
1417
+ `"unexpected-response"`
1418
+
1419
+ ###### listener
1420
+
1421
+ (`this`, `request`, `response`) => `void`
1422
+
1423
+ ##### Returns
1424
+
1425
+ `this`
1426
+
1427
+ ##### Inherited from
1428
+
1429
+ `WebSocketAlias.once`
1430
+
1431
+ #### Call Signature
1432
+
1433
+ > **once**(`event`, `listener`): `this`
1434
+
1435
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:156
1436
+
1437
+ ##### Parameters
1438
+
1439
+ ###### event
1440
+
1441
+ `string` \| `symbol`
1442
+
1443
+ ###### listener
1444
+
1445
+ (`this`, ...`args`) => `void`
1446
+
1447
+ ##### Returns
1448
+
1449
+ `this`
1450
+
1451
+ ##### Inherited from
1452
+
1453
+ `WebSocketAlias.once`
1454
+
1455
+ ***
1456
+
1457
+ ### pause()
1458
+
1459
+ > **pause**(): `void`
1460
+
1461
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:109
1462
+
1463
+ Pause the websocket causing it to stop emitting events. Some events can still be
1464
+ emitted after this is called, until all buffered data is consumed. This method
1465
+ is a noop if the ready state is `CONNECTING` or `CLOSED`.
1466
+
1467
+ #### Returns
1468
+
1469
+ `void`
1470
+
1471
+ #### Inherited from
1472
+
1473
+ `WebSocketAlias.pause`
1474
+
1475
+ ***
1476
+
1477
+ ### ping()
1478
+
1479
+ > **ping**(`data?`, `mask?`, `cb?`): `void`
1480
+
1481
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:88
1482
+
1483
+ #### Parameters
1484
+
1485
+ ##### data?
1486
+
1487
+ `any`
1488
+
1489
+ ##### mask?
1490
+
1491
+ `boolean`
1492
+
1493
+ ##### cb?
1494
+
1495
+ (`err`) => `void`
1496
+
1497
+ #### Returns
1498
+
1499
+ `void`
1500
+
1501
+ #### Inherited from
1502
+
1503
+ `WebSocketAlias.ping`
1504
+
1505
+ ***
1506
+
1507
+ ### pong()
1508
+
1509
+ > **pong**(`data?`, `mask?`, `cb?`): `void`
1510
+
1511
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:89
1512
+
1513
+ #### Parameters
1514
+
1515
+ ##### data?
1516
+
1517
+ `any`
1518
+
1519
+ ##### mask?
1520
+
1521
+ `boolean`
1522
+
1523
+ ##### cb?
1524
+
1525
+ (`err`) => `void`
1526
+
1527
+ #### Returns
1528
+
1529
+ `void`
1530
+
1531
+ #### Inherited from
1532
+
1533
+ `WebSocketAlias.pong`
1534
+
1535
+ ***
1536
+
1537
+ ### prependListener()
1538
+
1539
+ > **prependListener**(`eventName`, `listener`): `this`
1540
+
1541
+ Defined in: node\_modules/.pnpm/@types+node@20.11.0/node\_modules/@types/node/events.d.ts:834
1542
+
1543
+ Adds the `listener` function to the _beginning_ of the listeners array for the
1544
+ event named `eventName`. No checks are made to see if the `listener` has
1545
+ already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple
1546
+ times.
1547
+
1548
+ ```js
1549
+ server.prependListener('connection', (stream) => {
1550
+ console.log('someone connected!');
1551
+ });
1552
+ ```
1553
+
1554
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
1555
+
1556
+ #### Parameters
1557
+
1558
+ ##### eventName
1559
+
1560
+ `string` \| `symbol`
1561
+
1562
+ The name of the event.
1563
+
1564
+ ##### listener
1565
+
1566
+ (...`args`) => `void`
1567
+
1568
+ The callback function
1569
+
1570
+ #### Returns
1571
+
1572
+ `this`
1573
+
1574
+ #### Since
1575
+
1576
+ v6.0.0
1577
+
1578
+ #### Inherited from
1579
+
1580
+ `WebSocketAlias.prependListener`
1581
+
1582
+ ***
1583
+
1584
+ ### prependOnceListener()
1585
+
1586
+ > **prependOnceListener**(`eventName`, `listener`): `this`
1587
+
1588
+ Defined in: node\_modules/.pnpm/@types+node@20.11.0/node\_modules/@types/node/events.d.ts:850
1589
+
1590
+ Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this
1591
+ listener is removed, and then invoked.
1592
+
1593
+ ```js
1594
+ server.prependOnceListener('connection', (stream) => {
1595
+ console.log('Ah, we have our first user!');
1596
+ });
1597
+ ```
1598
+
1599
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
1600
+
1601
+ #### Parameters
1602
+
1603
+ ##### eventName
1604
+
1605
+ `string` \| `symbol`
1606
+
1607
+ The name of the event.
1608
+
1609
+ ##### listener
1610
+
1611
+ (...`args`) => `void`
1612
+
1613
+ The callback function
1614
+
1615
+ #### Returns
1616
+
1617
+ `this`
1618
+
1619
+ #### Since
1620
+
1621
+ v6.0.0
1622
+
1623
+ #### Inherited from
1624
+
1625
+ `WebSocketAlias.prependOnceListener`
1626
+
1627
+ ***
1628
+
1629
+ ### rawListeners()
1630
+
1631
+ > **rawListeners**(`eventName`): [`Function`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function)[]
1632
+
1633
+ Defined in: node\_modules/.pnpm/@types+node@20.11.0/node\_modules/@types/node/events.d.ts:766
1634
+
1635
+ Returns a copy of the array of listeners for the event named `eventName`,
1636
+ including any wrappers (such as those created by `.once()`).
1637
+
1638
+ ```js
1639
+ import { EventEmitter } from 'node:events';
1640
+ const emitter = new EventEmitter();
1641
+ emitter.once('log', () => console.log('log once'));
1642
+
1643
+ // Returns a new Array with a function `onceWrapper` which has a property
1644
+ // `listener` which contains the original listener bound above
1645
+ const listeners = emitter.rawListeners('log');
1646
+ const logFnWrapper = listeners[0];
1647
+
1648
+ // Logs "log once" to the console and does not unbind the `once` event
1649
+ logFnWrapper.listener();
1650
+
1651
+ // Logs "log once" to the console and removes the listener
1652
+ logFnWrapper();
1653
+
1654
+ emitter.on('log', () => console.log('log persistently'));
1655
+ // Will return a new Array with a single function bound by `.on()` above
1656
+ const newListeners = emitter.rawListeners('log');
1657
+
1658
+ // Logs "log persistently" twice
1659
+ newListeners[0]();
1660
+ emitter.emit('log');
1661
+ ```
1662
+
1663
+ #### Parameters
1664
+
1665
+ ##### eventName
1666
+
1667
+ `string` \| `symbol`
1668
+
1669
+ #### Returns
1670
+
1671
+ [`Function`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function)[]
1672
+
1673
+ #### Since
1674
+
1675
+ v9.4.0
1676
+
1677
+ #### Inherited from
1678
+
1679
+ `WebSocketAlias.rawListeners`
1680
+
1681
+ ***
1682
+
1683
+ ### removeAllListeners()
1684
+
1685
+ > **removeAllListeners**(`event?`): `this`
1686
+
1687
+ Defined in: node\_modules/.pnpm/@types+node@20.11.0/node\_modules/@types/node/events.d.ts:706
1688
+
1689
+ Removes all listeners, or those of the specified `eventName`.
1690
+
1691
+ It is bad practice to remove listeners added elsewhere in the code,
1692
+ particularly when the `EventEmitter` instance was created by some other
1693
+ component or module (e.g. sockets or file streams).
1694
+
1695
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
1696
+
1697
+ #### Parameters
1698
+
1699
+ ##### event?
1700
+
1701
+ `string` \| `symbol`
1702
+
1703
+ #### Returns
1704
+
1705
+ `this`
1706
+
1707
+ #### Since
1708
+
1709
+ v0.1.26
1710
+
1711
+ #### Inherited from
1712
+
1713
+ `WebSocketAlias.removeAllListeners`
1714
+
1715
+ ***
1716
+
1717
+ ### removeEventListener()
1718
+
1719
+ > **removeEventListener**\<`K`\>(`type`, `listener`): `void`
1720
+
1721
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:124
1722
+
1723
+ #### Type Parameters
1724
+
1725
+ ##### K
1726
+
1727
+ `K` *extends* keyof `WebSocketEventMap`
1728
+
1729
+ #### Parameters
1730
+
1731
+ ##### type
1732
+
1733
+ `K`
1734
+
1735
+ ##### listener
1736
+
1737
+ ((`event`) => `void`) \| \{ `handleEvent`: `void`; \}
1738
+
1739
+ #### Returns
1740
+
1741
+ `void`
1742
+
1743
+ #### Inherited from
1744
+
1745
+ `WebSocketAlias.removeEventListener`
1746
+
1747
+ ***
1748
+
1749
+ ### removeListener()
1750
+
1751
+ #### Call Signature
1752
+
1753
+ > **removeListener**(`event`, `listener`): `this`
1754
+
1755
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:184
1756
+
1757
+ Removes the specified `listener` from the listener array for the event named`eventName`.
1758
+
1759
+ ```js
1760
+ const callback = (stream) => {
1761
+ console.log('someone connected!');
1762
+ };
1763
+ server.on('connection', callback);
1764
+ // ...
1765
+ server.removeListener('connection', callback);
1766
+ ```
1767
+
1768
+ `removeListener()` will remove, at most, one instance of a listener from the
1769
+ listener array. If any single listener has been added multiple times to the
1770
+ listener array for the specified `eventName`, then `removeListener()` must be
1771
+ called multiple times to remove each instance.
1772
+
1773
+ Once an event is emitted, all listeners attached to it at the
1774
+ time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution
1775
+ will not remove them from`emit()` in progress. Subsequent events behave as expected.
1776
+
1777
+ ```js
1778
+ import { EventEmitter } from 'node:events';
1779
+ class MyEmitter extends EventEmitter {}
1780
+ const myEmitter = new MyEmitter();
1781
+
1782
+ const callbackA = () => {
1783
+ console.log('A');
1784
+ myEmitter.removeListener('event', callbackB);
1785
+ };
1786
+
1787
+ const callbackB = () => {
1788
+ console.log('B');
1789
+ };
1790
+
1791
+ myEmitter.on('event', callbackA);
1792
+
1793
+ myEmitter.on('event', callbackB);
1794
+
1795
+ // callbackA removes listener callbackB but it will still be called.
1796
+ // Internal listener array at time of emit [callbackA, callbackB]
1797
+ myEmitter.emit('event');
1798
+ // Prints:
1799
+ // A
1800
+ // B
1801
+
1802
+ // callbackB is now removed.
1803
+ // Internal listener array [callbackA]
1804
+ myEmitter.emit('event');
1805
+ // Prints:
1806
+ // A
1807
+ ```
1808
+
1809
+ Because listeners are managed using an internal array, calling this will
1810
+ change the position indices of any listener registered _after_ the listener
1811
+ being removed. This will not impact the order in which listeners are called,
1812
+ but it means that any copies of the listener array as returned by
1813
+ the `emitter.listeners()` method will need to be recreated.
1814
+
1815
+ When a single function has been added as a handler multiple times for a single
1816
+ event (as in the example below), `removeListener()` will remove the most
1817
+ recently added instance. In the example the `once('ping')`listener is removed:
1818
+
1819
+ ```js
1820
+ import { EventEmitter } from 'node:events';
1821
+ const ee = new EventEmitter();
1822
+
1823
+ function pong() {
1824
+ console.log('pong');
1825
+ }
1826
+
1827
+ ee.on('ping', pong);
1828
+ ee.once('ping', pong);
1829
+ ee.removeListener('ping', pong);
1830
+
1831
+ ee.emit('ping');
1832
+ ee.emit('ping');
1833
+ ```
1834
+
1835
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
1836
+
1837
+ ##### Parameters
1838
+
1839
+ ###### event
1840
+
1841
+ `"close"`
1842
+
1843
+ ###### listener
1844
+
1845
+ (`code`, `reason`) => `void`
1846
+
1847
+ ##### Returns
1848
+
1849
+ `this`
1850
+
1851
+ ##### Since
1852
+
1853
+ v0.1.26
1854
+
1855
+ ##### Inherited from
1856
+
1857
+ `WebSocketAlias.removeListener`
1858
+
1859
+ #### Call Signature
1860
+
1861
+ > **removeListener**(`event`, `listener`): `this`
1862
+
1863
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:185
1864
+
1865
+ ##### Parameters
1866
+
1867
+ ###### event
1868
+
1869
+ `"error"`
1870
+
1871
+ ###### listener
1872
+
1873
+ (`error`) => `void`
1874
+
1875
+ ##### Returns
1876
+
1877
+ `this`
1878
+
1879
+ ##### Inherited from
1880
+
1881
+ `WebSocketAlias.removeListener`
1882
+
1883
+ #### Call Signature
1884
+
1885
+ > **removeListener**(`event`, `listener`): `this`
1886
+
1887
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:186
1888
+
1889
+ ##### Parameters
1890
+
1891
+ ###### event
1892
+
1893
+ `"upgrade"`
1894
+
1895
+ ###### listener
1896
+
1897
+ (`request`) => `void`
1898
+
1899
+ ##### Returns
1900
+
1901
+ `this`
1902
+
1903
+ ##### Inherited from
1904
+
1905
+ `WebSocketAlias.removeListener`
1906
+
1907
+ #### Call Signature
1908
+
1909
+ > **removeListener**(`event`, `listener`): `this`
1910
+
1911
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:187
1912
+
1913
+ ##### Parameters
1914
+
1915
+ ###### event
1916
+
1917
+ `"message"`
1918
+
1919
+ ###### listener
1920
+
1921
+ (`data`, `isBinary`) => `void`
1922
+
1923
+ ##### Returns
1924
+
1925
+ `this`
1926
+
1927
+ ##### Inherited from
1928
+
1929
+ `WebSocketAlias.removeListener`
1930
+
1931
+ #### Call Signature
1932
+
1933
+ > **removeListener**(`event`, `listener`): `this`
1934
+
1935
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:188
1936
+
1937
+ ##### Parameters
1938
+
1939
+ ###### event
1940
+
1941
+ `"open"`
1942
+
1943
+ ###### listener
1944
+
1945
+ () => `void`
1946
+
1947
+ ##### Returns
1948
+
1949
+ `this`
1950
+
1951
+ ##### Inherited from
1952
+
1953
+ `WebSocketAlias.removeListener`
1954
+
1955
+ #### Call Signature
1956
+
1957
+ > **removeListener**(`event`, `listener`): `this`
1958
+
1959
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:189
1960
+
1961
+ ##### Parameters
1962
+
1963
+ ###### event
1964
+
1965
+ `"ping"` \| `"pong"`
1966
+
1967
+ ###### listener
1968
+
1969
+ (`data`) => `void`
1970
+
1971
+ ##### Returns
1972
+
1973
+ `this`
1974
+
1975
+ ##### Inherited from
1976
+
1977
+ `WebSocketAlias.removeListener`
1978
+
1979
+ #### Call Signature
1980
+
1981
+ > **removeListener**(`event`, `listener`): `this`
1982
+
1983
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:190
1984
+
1985
+ ##### Parameters
1986
+
1987
+ ###### event
1988
+
1989
+ `"redirect"`
1990
+
1991
+ ###### listener
1992
+
1993
+ (`url`, `request`) => `void`
1994
+
1995
+ ##### Returns
1996
+
1997
+ `this`
1998
+
1999
+ ##### Inherited from
2000
+
2001
+ `WebSocketAlias.removeListener`
2002
+
2003
+ #### Call Signature
2004
+
2005
+ > **removeListener**(`event`, `listener`): `this`
2006
+
2007
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:191
2008
+
2009
+ ##### Parameters
2010
+
2011
+ ###### event
2012
+
2013
+ `"unexpected-response"`
2014
+
2015
+ ###### listener
2016
+
2017
+ (`request`, `response`) => `void`
2018
+
2019
+ ##### Returns
2020
+
2021
+ `this`
2022
+
2023
+ ##### Inherited from
2024
+
2025
+ `WebSocketAlias.removeListener`
2026
+
2027
+ #### Call Signature
2028
+
2029
+ > **removeListener**(`event`, `listener`): `this`
2030
+
2031
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:195
2032
+
2033
+ ##### Parameters
2034
+
2035
+ ###### event
2036
+
2037
+ `string` \| `symbol`
2038
+
2039
+ ###### listener
2040
+
2041
+ (...`args`) => `void`
2042
+
2043
+ ##### Returns
2044
+
2045
+ `this`
2046
+
2047
+ ##### Inherited from
2048
+
2049
+ `WebSocketAlias.removeListener`
2050
+
2051
+ ***
2052
+
2053
+ ### resume()
2054
+
2055
+ > **resume**(): `void`
2056
+
2057
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:114
2058
+
2059
+ Make a paused socket resume emitting events. This method is a noop if the ready
2060
+ state is `CONNECTING` or `CLOSED`.
2061
+
2062
+ #### Returns
2063
+
2064
+ `void`
2065
+
2066
+ #### Inherited from
2067
+
2068
+ `WebSocketAlias.resume`
2069
+
2070
+ ***
2071
+
2072
+ ### send()
2073
+
2074
+ #### Call Signature
2075
+
2076
+ > **send**(`data`, `cb?`): `void`
2077
+
2078
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:91
2079
+
2080
+ ##### Parameters
2081
+
2082
+ ###### data
2083
+
2084
+ `BufferLike`
2085
+
2086
+ ###### cb?
2087
+
2088
+ (`err?`) => `void`
2089
+
2090
+ ##### Returns
2091
+
2092
+ `void`
2093
+
2094
+ ##### Inherited from
2095
+
2096
+ `WebSocketAlias.send`
2097
+
2098
+ #### Call Signature
2099
+
2100
+ > **send**(`data`, `options`, `cb?`): `void`
2101
+
2102
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:92
2103
+
2104
+ ##### Parameters
2105
+
2106
+ ###### data
2107
+
2108
+ `BufferLike`
2109
+
2110
+ ###### options
2111
+
2112
+ ###### binary?
2113
+
2114
+ `boolean`
2115
+
2116
+ ###### compress?
2117
+
2118
+ `boolean`
2119
+
2120
+ ###### fin?
2121
+
2122
+ `boolean`
2123
+
2124
+ ###### mask?
2125
+
2126
+ `boolean`
2127
+
2128
+ ###### cb?
2129
+
2130
+ (`err?`) => `void`
2131
+
2132
+ ##### Returns
2133
+
2134
+ `void`
2135
+
2136
+ ##### Inherited from
2137
+
2138
+ `WebSocketAlias.send`
2139
+
2140
+ ***
2141
+
2142
+ ### setMaxListeners()
2143
+
2144
+ > **setMaxListeners**(`n`): `this`
2145
+
2146
+ Defined in: node\_modules/.pnpm/@types+node@20.11.0/node\_modules/@types/node/events.d.ts:716
2147
+
2148
+ By default `EventEmitter`s will print a warning if more than `10` listeners are
2149
+ added for a particular event. This is a useful default that helps finding
2150
+ memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
2151
+ modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners.
2152
+
2153
+ Returns a reference to the `EventEmitter`, so that calls can be chained.
2154
+
2155
+ #### Parameters
2156
+
2157
+ ##### n
2158
+
2159
+ `number`
2160
+
2161
+ #### Returns
2162
+
2163
+ `this`
2164
+
2165
+ #### Since
2166
+
2167
+ v0.3.5
2168
+
2169
+ #### Inherited from
2170
+
2171
+ `WebSocketAlias.setMaxListeners`
2172
+
2173
+ ***
2174
+
2175
+ ### terminate()
2176
+
2177
+ > **terminate**(): `void`
2178
+
2179
+ Defined in: node\_modules/.pnpm/@types+ws@8.18.1/node\_modules/@types/ws/index.d.ts:102
2180
+
2181
+ #### Returns
2182
+
2183
+ `void`
2184
+
2185
+ #### Inherited from
2186
+
2187
+ `WebSocketAlias.terminate`