-
Notifications
You must be signed in to change notification settings - Fork 0
docs: 429 stream error now dispatches StreamError event #506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
797168d
225f661
4e94b8f
a0192a0
5a51186
3ce604f
1b6dd22
f835e7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -463,7 +463,7 @@ Event::LoggedOut(logout) => { | |
|
|
||
| ### StreamError | ||
|
|
||
| **Emitted:** For unrecognized stream error codes (codes not matching 401, 409, 429, 503, 515, or 516) | ||
| **Emitted:** For a `429` (rate-limited) stream error, and for unrecognized stream error codes (codes not matching 401, 409, 503, 515, or 516). Since [#1263](https://github.com/oxidezap/whatsapp-rust/pull/1263), the client reports 429 the same way as every other coded branch — WhatsApp Web's own handler has no arm for it either (only `500..600` is special-cased there), so this is an embedder-facing choice rather than a fidelity fix. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The parenthetical now defines an unrecognized code as any code not matching 401, 409, 503, 515, or 516, which makes 429 satisfy that definition even though this sentence and the list below treat it as a specific rate-limit case. Retain 429 in the exclusion list while separately noting that it emits the generic Useful? React with 👍 / 👎. |
||
|
|
||
| ```rust | ||
| #[derive(Debug, Clone, Serialize, bon::Builder)] | ||
|
|
@@ -482,10 +482,10 @@ Event::StreamError(err) => { | |
| ``` | ||
|
|
||
| <Note> | ||
| Recognized stream error codes emit specific events instead of `StreamError`: | ||
| Specific stream error codes have the following event behavior: | ||
| - **401** → `LoggedOut` (session invalidated) | ||
| - **409** → `StreamReplaced` (another client connected) | ||
| - **429** → No event emitted (reconnects with extended backoff) | ||
| - **429** → `StreamError` (rate limited; also reconnects with extended backoff) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Once 429 reaches this event, the unchanged usage example above prints Useful? React with 👍 / 👎. |
||
| - **503** → No event emitted (reconnects with normal backoff) | ||
| - **515** → No event emitted (immediate reconnect, e.g., after pairing) | ||
| - **516** → `LoggedOut` (device removed) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added paragraph packs change history, WhatsApp Web behavior, embedder rationale, event ordering, and reconnect semantics into two long sentences. Split these into single-idea sentences so the event contract remains easy to scan and complies with the repository's explicit concise-sentence standard.
AGENTS.md reference: AGENTS.md:L25-L25
Useful? React with 👍 / 👎.