summaryrefslogtreecommitdiff
path: root/cli/dts
diff options
context:
space:
mode:
authorLeo K <crowlkats@toaxl.com>2021-08-10 00:28:17 +0200
committerGitHub <noreply@github.com>2021-08-10 00:28:17 +0200
commit2db381eba9768acf855219ec9560e20a62659994 (patch)
treec06a693b804c9a2bc3bf76f7ac66a02f57499ccb /cli/dts
parent7600a456dfc880a1eeff230f3f34c87978fedc58 (diff)
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
Diffstat (limited to 'cli/dts')
-rw-r--r--cli/dts/lib.deno.unstable.d.ts25
1 files changed, 25 insertions, 0 deletions
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<string | Uint8Array>;
+ writable: WritableStream<string | Uint8Array>;
+ extensions: string;
+ protocol: string;
+}
+
+declare interface WebSocketCloseInfo {
+ code?: number;
+ reason?: string;
+}
+
+declare class WebSocketStream {
+ constructor(url: string, options?: WebSocketStreamOptions);
+ url: string;
+ connection: Promise<WebSocketConnection>;
+ closed: Promise<WebSocketCloseInfo>;
+ close(closeInfo?: WebSocketCloseInfo): void;
+}