Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/ws.ts>WebSocketServer#upgrade

A JavaScript extension package for building strong and modern applications.
Latest
method WebSocketServer.prototype.upgrade
import { WebSocketServer } from "https://deno.land/x/ayonli_jsext@v0.9.72/ws.ts";

Upgrades the request to a WebSocket connection in Deno, Bun and Cloudflare Workers.

This function can also be used in Node.js if the HTTP request listener is created using the withWeb function from @ayonli/jsext/http module.

NOTE: This function fails if the request is not a WebSocket upgrade request.

Returns

{ socket: WebSocketConnection; response: Response; }

Upgrades the request to a WebSocket connection in Node.js.

NOTE: This function fails if the request is not a WebSocket upgrade request.