Skip to content

Commit 95a7489

Browse files
committed
Add 'createConnection' client option
Introduced in v8.17.0 via websockets/ws#2219
1 parent 9aeda83 commit 95a7489

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

types/ws/index.d.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Server as HTTPServer,
1111
} from "http";
1212
import { Server as HTTPSServer } from "https";
13+
import { createConnection } from "net";
1314
import { Duplex, DuplexOptions } from "stream";
1415
import { SecureContextOptions } from "tls";
1516
import { URL } from "url";
@@ -257,6 +258,7 @@ declare namespace WebSocket {
257258
autoPong?: boolean | undefined;
258259
maxPayload?: number | undefined;
259260
skipUTF8Validation?: boolean | undefined;
261+
createConnection?: typeof createConnection | undefined;
260262
finishRequest?: FinishRequestCallback | undefined;
261263
}
262264

types/ws/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Server as HTTPServer,
1111
} from "http";
1212
import { Server as HTTPSServer } from "https";
13+
import { createConnection } from "net";
1314
import { Duplex, DuplexOptions } from "stream";
1415
import { SecureContextOptions } from "tls";
1516
import { URL } from "url";
@@ -260,6 +261,7 @@ declare namespace WebSocket {
260261
autoPong?: boolean | undefined;
261262
maxPayload?: number | undefined;
262263
skipUTF8Validation?: boolean | undefined;
264+
createConnection?: typeof createConnection | undefined;
263265
finishRequest?: FinishRequestCallback | undefined;
264266
}
265267

types/ws/ws-tests.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as http from "http";
22
import * as https from "https";
3+
import * as net from "net";
34
import * as url from "url";
45
import WebSocket from "ws";
56
// eslint-disable-next-line no-duplicate-imports
@@ -528,6 +529,7 @@ declare module "ws" {
528529
const ws = new WebSocket("ws://www.host.com/path", {
529530
allowSynchronousEvents: false,
530531
autoPong: false,
532+
createConnection: net.createConnection,
531533
finishRequest: (req, socket) => {
532534
// $ExpectType IncomingMessage
533535
req;

types/ws/ws-tests.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import WebSocket = require("ws");
22
import * as http from "http";
33
import * as https from "https";
4+
import * as net from "net";
45
import * as url from "url";
56
import * as wslib from "ws";
67

@@ -520,6 +521,7 @@ declare module "ws" {
520521
const ws = new WebSocket("ws://www.host.com/path", {
521522
allowSynchronousEvents: false,
522523
autoPong: false,
524+
createConnection: net.createConnection,
523525
finishRequest: (req, socket) => {
524526
// $ExpectType IncomingMessage
525527
req;

0 commit comments

Comments
 (0)