From 4134750ef6921c8f0fcac898594101a6ca5f4f4f Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Tue, 17 Dec 2024 20:46:15 +0100 Subject: Initial commit --- types/web-socket-stream/index.d.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 types/web-socket-stream/index.d.ts (limited to 'types/web-socket-stream') diff --git a/types/web-socket-stream/index.d.ts b/types/web-socket-stream/index.d.ts new file mode 100644 index 0000000..ebecb22 --- /dev/null +++ b/types/web-socket-stream/index.d.ts @@ -0,0 +1,24 @@ +declare interface WebSocketOpenInfo { + readable: ReadableStream + writable: WritableStream + extensions: string + protocol: string +} + +declare interface WebSocketCloseInfo { + closeCode: number + reason: string +} + +declare interface WebSocketStreamOptions { + protocols?: string[] + signal?: AbortSignal +} + +declare class WebSocketStream { + constructor(url: string, options?: WebSocketStreamOptions) + readonly url: string + readonly opened: Promise + readonly closed: Promise + close(closeInfo?: WebSocketCloseInfo): any +} \ No newline at end of file -- cgit v1.2.3-70-g09d2