Skip to content

feat(ws-client): respond with pong to ping messages#12

Merged
gioto64 merged 1 commit intoelliottech:mainfrom
hmate9:feat/ws-client-pong-response
Oct 23, 2025
Merged

feat(ws-client): respond with pong to ping messages#12
gioto64 merged 1 commit intoelliottech:mainfrom
hmate9:feat/ws-client-pong-response

Conversation

@hmate9
Copy link
Copy Markdown
Contributor

@hmate9 hmate9 commented May 17, 2025

  • Update WsClient to automatically send a "pong" message in response to any received "ping" message, for both sync and async websocket usage.
  • Adds ping detection in on_message and on_message_async.
  • Sends back a {"type": "pong"} payload.
  • No breaking changes; existing subscriptions and message flows are unaffected.

- Update WsClient to automatically send a "pong" message in response to any received "ping" message, for both sync and async websocket usage.
- Adds ping detection in on_message and on_message_async.
- Sends back a {"type": "pong"} payload.
- No breaking changes; existing subscriptions and message flows are unaffected.
@Ge0
Copy link
Copy Markdown

Ge0 commented Oct 4, 2025

Why on Earth this PR isn’t merged?

Comment thread lighter/ws_client.py
self.handle_subscribed_account(message)
elif message_type == "update/account_all":
self.handle_update_account(message)
elif message_type == "ping":
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, as you handle the ping case below.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need this when using synchronous run without asyncio.

@issacnumb
Copy link
Copy Markdown

I also encountered this problem when running ws.py in the example. It seems that it has not been solved. What should I do?

@gioto64 gioto64 merged commit a89cb09 into elliottech:main Oct 23, 2025
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.

5 participants