From 2db381eba9768acf855219ec9560e20a62659994 Mon Sep 17 00:00:00 2001 From: Leo K Date: Tue, 10 Aug 2021 00:28:17 +0200 Subject: feat: add experimental WebSocketStream API (#10365) This commit adds the experimental WebSocketStream API when using the --unstable flag. The explainer for the API can be found here: https://github.com/ricea/websocketstream-explainer --- cli/dts/lib.deno.unstable.d.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'cli/dts') diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts index ab4a63729..b83309bc9 100644 --- a/cli/dts/lib.deno.unstable.d.ts +++ b/cli/dts/lib.deno.unstable.d.ts @@ -1152,3 +1152,28 @@ declare interface WorkerOptions { }; }; } + +declare interface WebSocketStreamOptions { + protocols?: string[]; + signal?: AbortSignal; +} + +declare interface WebSocketConnection { + readable: ReadableStream; + writable: WritableStream; + extensions: string; + protocol: string; +} + +declare interface WebSocketCloseInfo { + code?: number; + reason?: string; +} + +declare class WebSocketStream { + constructor(url: string, options?: WebSocketStreamOptions); + url: string; + connection: Promise; + closed: Promise; + close(closeInfo?: WebSocketCloseInfo): void; +} -- cgit v1.2.3