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+
14// Same as exported type in @hapi /hapi v20
25type HTTP_METHODS = 'ACL' | 'BIND' | 'CHECKOUT' | 'CONNECT' | 'COPY' | 'DELETE' | 'GET' | 'HEAD' | 'LINK' | 'LOCK' |
36 'M-SEARCH' | 'MERGE' | 'MKACTIVITY' | 'MKCALENDAR' | 'MKCOL' | 'MOVE' | 'NOTIFY' | 'OPTIONS' | 'PATCH' | 'POST' |
@@ -173,7 +176,7 @@ export class Client {
173176 constructor (
174177 url : `ws://${string } ` | `wss://${string } `,
175178 options ?: {
176- ws ?: string | string [ ] ;
179+ ws ?: ClientOptions | ClientRequestArgs ;
177180 timeout ?: number | boolean ;
178181 } ) ;
179182
@@ -369,4 +372,4 @@ export class Client {
369372 * `client.connect()`
370373 */
371374 reauthenticate ( auth : ClientConnectOptions [ 'auth' ] ) : Promise < unknown > ;
372- }
375+ }
Original file line number Diff line number Diff line change 2525 "@hapi/iron" : " ^7.0.1" ,
2626 "@hapi/teamwork" : " ^6.0.0" ,
2727 "@hapi/validate" : " ^2.0.1" ,
28+ "@types/ws" : " ^8.5.13" ,
2829 "ws" : " ^8.18.0"
2930 },
3031 "devDependencies" : {
Original file line number Diff line number Diff line change @@ -7,7 +7,13 @@ import { Client } from '../../lib/client';
77
88const init = ( ) => {
99
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+ } ) ;
1117
1218 client . connect ( )
1319
You can’t perform that action at this time.
0 commit comments