File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,24 @@ description: |
66Fresh provides built-in helpers for upgrading HTTP connections to WebSockets.
77There are two main approaches depending on your use case.
88
9+ > [ info] : WebSocket upgrades under the Vite dev server (` deno task dev ` ) require
10+ > ** Fresh 2.4+** and ** Deno 2.8+** . On older versions ` Deno.upgradeWebSocket() `
11+ > cannot complete the 101 handshake for requests Vite forwards from its Node
12+ > HTTP server, so ` ctx.upgrade() ` and ` app.ws() ` silently hang and the ` open `
13+ > handler is never invoked.
14+ >
15+ > If you're stuck on an older Deno or Fresh, exercise WebSocket endpoints with a
16+ > production-style build instead:
17+ >
18+ > ``` sh
19+ > deno task build && deno task start
20+ > ` ` `
21+ >
22+ > This runs ` deno serve` directly, so ` Deno.upgradeWebSocket()` works as
23+ > expected. Alternatively, run a separate Deno entry point (e.g.
24+ > ` deno serve -A main.ts` ) alongside Vite, or host the WebSocket server as a
25+ > sidecar on its own port.
26+
927# # Quick start with `app.ws()`
1028
1129The simplest way to add a WebSocket endpoint:
You can’t perform that action at this time.
0 commit comments