File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change
1
+ import type { ClientRequestArgs } from "http" ;
2
+ import type { ClientOptions } from "ws" ;
3
+
1
4
// Same as exported type in @hapi /hapi v20
2
5
type HTTP_METHODS = 'ACL' | 'BIND' | 'CHECKOUT' | 'CONNECT' | 'COPY' | 'DELETE' | 'GET' | 'HEAD' | 'LINK' | 'LOCK' |
3
6
'M-SEARCH' | 'MERGE' | 'MKACTIVITY' | 'MKCALENDAR' | 'MKCOL' | 'MOVE' | 'NOTIFY' | 'OPTIONS' | 'PATCH' | 'POST' |
@@ -173,7 +176,7 @@ export class Client {
173
176
constructor (
174
177
url : `ws://${string } ` | `wss://${string } `,
175
178
options ?: {
176
- ws ?: string | string [ ] ;
179
+ ws ?: ClientOptions | ClientRequestArgs ;
177
180
timeout ?: number | boolean ;
178
181
} ) ;
179
182
@@ -369,4 +372,4 @@ export class Client {
369
372
* `client.connect()`
370
373
*/
371
374
reauthenticate ( auth : ClientConnectOptions [ 'auth' ] ) : Promise < unknown > ;
372
- }
375
+ }
Original file line number Diff line number Diff line change 25
25
"@hapi/iron" : " ^7.0.1" ,
26
26
"@hapi/teamwork" : " ^6.0.0" ,
27
27
"@hapi/validate" : " ^2.0.1" ,
28
+ "@types/ws" : " ^8.5.13" ,
28
29
"ws" : " ^8.18.0"
29
30
},
30
31
"devDependencies" : {
Original file line number Diff line number Diff line change @@ -7,7 +7,13 @@ import { Client } from '../../lib/client';
7
7
8
8
const init = ( ) => {
9
9
10
- const client = new Client ( 'ws://localhost' ) ;
10
+ const client = new Client ( 'ws://localhost' , {
11
+ ws : { // optional
12
+ origin : 'http://localhost:12345' ,
13
+ maxPayload : 1000 ,
14
+ headers : { cookie : 'xnes=123' }
15
+ }
16
+ } ) ;
11
17
12
18
client . connect ( )
13
19
You can’t perform that action at this time.
0 commit comments