Skip to content

fix(ws): ignore non-object JSON frames in sync and async clients - #204

Open
0xdefimaster wants to merge 2 commits into
elliottech:mainfrom
0xdefimaster:fix/ws-non-object-json
Open

0xdefimaster wants to merge 2 commits into
elliottech:mainfrom
0xdefimaster:fix/ws-non-object-json

Conversation

@0xdefimaster

Copy link
Copy Markdown

Fixes #123.

This PR prevents the sync and async WebSocket handlers from crashing on valid non-object JSON frames such as "heartbeat", null, [], numbers and booleans.

  • Adds a type check before accessing .get("type").
  • Preserves normal WebSocket message handling and ping/pong behavior.
  • Adds four offline regression tests covering both handlers.

Related to #172, but intentionally scoped to #123 with dedicated regression tests.

No credentials or live trading required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: on_message_async crashes on non-object JSON messages (e.g. heartbeats)

1 participant