Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Support WebSocket Ping/Pong #765

Closed
zek opened this issue May 16, 2021 · 3 comments
Closed

Support WebSocket Ping/Pong #765

zek opened this issue May 16, 2021 · 3 comments

Comments

@zek
Copy link

zek commented May 16, 2021

Bug Explanation

I was testing websockets on an iOS application and noticed after 2 minutes events stopped cuz connection is marked as idle and removed due to lastPongedAt

However ping sent from iOS client and it receives pong response successfully. However it doesn't send pusher:ping instead it send ping message in TCP layer.

So ping messages were captured by Ratchet WsServer while laravel-websockets expects ping message differently.

image

Solution

I override onControlFrame as following and it works like a charm.

image

image

If you check https://pusher.com/docs/channels/library_auth_reference/pusher-websockets-protocol#ping-and-pong-messages they mention

In protocol versions 5 and above, when using an old version of the WebSocket protocol, Pusher Channels will send pusher:ping event

So it could be nice if we can support this functionality.

@mpociot
Copy link
Member

mpociot commented May 18, 2021

Can you send a PR that adds support for Pushers ping/pong implementation?

mdprotacio added a commit to koalaphils/laravel-websockets that referenced this issue Jun 1, 2021
@mdprotacio
Copy link
Contributor

I have almost similar issue on the lastPongedAt. Whenever the client receives an event, ping is not issued until 30seconds of inactivity. In a very busy client-server scenario where almost always we get events from channel, ping/pong is not being triggered as it is not idle for 30seconds (pusher default). Hence, connections are not updated with lastPongedAt and are treated as obsolete connections and are removed. #778 adds an update to mark the connections as ponged whenever we send messages to subscribers.

@lucadegasperi
Copy link

lucadegasperi commented Aug 17, 2021

I find myself having long running web pages (days or months) timeout after a while. Is there any progress on this issue? Is this something that needs to be implemented on the Ratchet side of things?

@zek zek closed this as completed Dec 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants