docs: document upgradeWebSocket and rework cross-isolate messaging - #5484
Open
philip wants to merge 5 commits into
Open
docs: document upgradeWebSocket and rework cross-isolate messaging#5484philip wants to merge 5 commits into
philip wants to merge 5 commits into
Conversation
philip
requested review from
andrelandgraf,
danieltprice and
ruf-io
as code owners
August 7, 2026 20:57
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
philip
force-pushed
the
docs/functions-websocket-upgrade
branch
from
September 1, 2026 14:32
74e45bb to
f1fe9fb
Compare
A refused handshake's status and body don't reach a WebSocket client, so drop the claim that a returned Response arrives intact. Note instead that the client sees only a generic connection failure, and to send any detail it needs over a separate authenticated request. Co-authored-by: Isaac <no-reply@databricks.com>
Lead with upgradeWebSocket for new functions and cover its real behavior: the standard WebSocket it returns, when it throws, subprotocol selection, and refusing a handshake. Reorganize cross-isolate messaging around polling as the default, which keeps scale to zero, with LISTEN/NOTIFY for always-on compute, and add a complete polling example. Correct the heartbeat, binaryType, and refusal notes. The examples were verified under neon dev and against a live database. Co-authored-by: Isaac <no-reply@databricks.com>
philip
force-pushed
the
docs/functions-websocket-upgrade
branch
from
September 1, 2026 17:50
c3145b3 to
21f7592
Compare
Guard each send with readyState === OPEN so a socket that is mid-close does not throw and abort the poll cycle, which would skip that row for the remaining clients. Co-authored-by: Isaac <no-reply@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Expands the WebSockets and SSE guide to cover
upgradeWebSocketfrom@neon/functionsand torethink cross-isolate messaging for scale-to-zero.
Serve a WebSocket
Lead with
upgradeWebSocket(open the socket from yourfetchhandler, no extra export and nowsdependency), alongside the existingupgradeexport for raw-socket cases. Adds a Honoexample that runs the handshake through route middleware, subprotocol selection, and a note
distinguishing the three same-named
upgradeWebSocketfunctions by package.Cross-isolate messaging
Recommends polling Postgres by default so functions keep scaling to zero, with
LISTEN/NOTIFYreserved for always-on compute that needs sub-second latency.
Also
cli/dev.md:neon devserves WebSocket upgrades locally. Removes the stale note claimingneon devreturns 200 for upgrades.