Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/client.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import type { ClientRequestArgs } from "http";
import type { ClientOptions } from "ws";

// Same as exported type in @hapi/hapi v20
type HTTP_METHODS = 'ACL' | 'BIND' | 'CHECKOUT' | 'CONNECT' | 'COPY' | 'DELETE' | 'GET' | 'HEAD' | 'LINK' | 'LOCK' |
'M-SEARCH' | 'MERGE' | 'MKACTIVITY' | 'MKCALENDAR' | 'MKCOL' | 'MOVE' | 'NOTIFY' | 'OPTIONS' | 'PATCH' | 'POST' |
Expand Down Expand Up @@ -173,7 +176,7 @@ export class Client {
constructor(
url: `ws://${string}` | `wss://${string}`,
options?: {
ws?: string | string[];
ws?: ClientOptions | ClientRequestArgs;
timeout?: number | boolean;
});

Expand Down Expand Up @@ -369,4 +372,4 @@ export class Client {
* `client.connect()`
*/
reauthenticate(auth: ClientConnectOptions['auth']): Promise<unknown>;
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@hapi/iron": "^7.0.1",
"@hapi/teamwork": "^6.0.0",
"@hapi/validate": "^2.0.1",
"@types/ws": "^8.5.13",
"ws": "^8.18.0"
},
"devDependencies": {
Expand Down
8 changes: 7 additions & 1 deletion test/types/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import { Client } from '../../lib/client';

const init = () => {

const client = new Client('ws://localhost');
const client = new Client('ws://localhost', {
ws: { // optional
origin: 'http://localhost:12345',
maxPayload: 1000,
headers: { cookie: 'xnes=123' }
}
});

client.connect()

Expand Down
Loading