Repository navigation
Fix the WebSocket event checks in the WebSockets guide - #335
Merged
Merged
Conversation
Every event frame has type "event"; the guide's TypeScript examples matched type === "message_received", which never fires. Match on eventType, like the quickstart, and read the sender as message.from. The event tables now list the type / event_type values a handler compares against. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sidharth0612
approved these changes
Oct 21, 2026
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.
Why
The TypeScript examples in
fern/pages/websockets.mdxbranched onevent.type === "message_received". The server sends every event withtype: "event"and puts the kind inevent_type(eventTypein the TypeScript SDK). So those branches never ran: a reader who copied the guide never saw an email arrive.The Basic Usage example also read
event.message.from_, which is the Python name; the TypeScript SDK calls itfrom.Change
event.type === "event" && event.eventType === "message.received", as the WebSockets quickstart and the x402 / MPP pages already do: Basic Usage, React, Error Handling, and Copy for Cursor / Claude.subscribed,message.received,domain.verified,calendar.event.created, ...). They used to list the SDK's message names (message_received, ...). One line explainstypevsevent_type.from.Verification
The corrected TypeScript snippets type-check against the Node SDK's generated types (
tsc --noEmit).Not changed
fern/changelog/2025-07-20.mdxstill showsevent.type === "message.received". It's a dated announcement, so it's left as published.🤖 Generated with Claude Code