mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
fix(ws): options is optional on createWebSocketStream (#43784)
This commit is contained in:
parent
558edadd09
commit
add4fc1a34
2
types/ws/index.d.ts
vendored
2
types/ws/index.d.ts
vendored
@ -264,7 +264,7 @@ declare namespace WebSocket {
|
||||
}
|
||||
|
||||
// WebSocket stream
|
||||
function createWebSocketStream(websocket: WebSocket, options: stream.DuplexOptions): stream.Duplex;
|
||||
function createWebSocketStream(websocket: WebSocket, options?: stream.DuplexOptions): stream.Duplex;
|
||||
}
|
||||
|
||||
export = WebSocket;
|
||||
|
||||
@ -149,3 +149,12 @@ import * as url from 'url';
|
||||
duplex.pipe(process.stdout);
|
||||
process.stdin.pipe(duplex);
|
||||
}
|
||||
|
||||
{
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
const duplex = WebSocket.createWebSocketStream(ws);
|
||||
|
||||
duplex.pipe(process.stdout);
|
||||
process.stdin.pipe(duplex);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user