summaryrefslogtreecommitdiff
path: root/cli/dts/lib.deno.unstable.d.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2021-09-13 14:06:12 +0200
committerGitHub <noreply@github.com>2021-09-13 14:06:12 +0200
commita95ca9dc70515240b1be7a12dbf686b1ebfb3490 (patch)
treec6dc232f1cce423fef903a65f52e3e7bf11f9d8b /cli/dts/lib.deno.unstable.d.ts
parent3ef23e25c608de1d3e16c2f4c2d10814ccc862bf (diff)
feat: stabilise Deno.upgradeWebSocket (#12024)
Diffstat (limited to 'cli/dts/lib.deno.unstable.d.ts')
-rw-r--r--cli/dts/lib.deno.unstable.d.ts47
1 files changed, 0 insertions, 47 deletions
diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts
index 82ab9f5a1..5854a5181 100644
--- a/cli/dts/lib.deno.unstable.d.ts
+++ b/cli/dts/lib.deno.unstable.d.ts
@@ -1003,53 +1003,6 @@ declare namespace Deno {
};
}
- export interface WebSocketUpgrade {
- response: Response;
- socket: WebSocket;
- }
-
- export interface UpgradeWebSocketOptions {
- protocol?: string;
- }
-
- /** **UNSTABLE**: new API, yet to be vetted.
- *
- * Used to upgrade an incoming HTTP request to a WebSocket.
- *
- * Given a request, returns a pair of WebSocket and Response. The original
- * request must be responded to with the returned response for the websocket
- * upgrade to be successful.
- *
- * ```ts
- * const conn = await Deno.connect({ port: 80, hostname: "127.0.0.1" });
- * const httpConn = Deno.serveHttp(conn);
- * const e = await httpConn.nextRequest();
- * if (e) {
- * const { socket, response } = Deno.upgradeWebSocket(e.request);
- * socket.onopen = () => {
- * socket.send("Hello World!");
- * };
- * socket.onmessage = (e) => {
- * console.log(e.data);
- * socket.close();
- * };
- * socket.onclose = () => console.log("WebSocket has been closed.");
- * socket.onerror = (e) => console.error("WebSocket error:", e);
- * e.respondWith(response);
- * }
- * ```
- *
- * If the request body is disturbed (read from) before the upgrade is
- * completed, upgrading fails.
- *
- * This operation does not yet consume the request or open the websocket. This
- * only happens once the returned response has been passed to `respondWith`.
- */
- export function upgradeWebSocket(
- request: Request,
- options?: UpgradeWebSocketOptions,
- ): WebSocketUpgrade;
-
/** The type of the resource record.
* Only the listed types are supported currently. */
export type RecordType =