laravel-websockets
laravel-websockets copied to clipboard
Websockets doesn't send events after receiving ping
Hi all,
Using 2.0.0-beta.36 and laravel v8.63.0
After Laravel Echo sends following event to the server:
{"event":"pusher:ping","data":{}}
The server responds with:
{"event":"pusher:pong"}
But after this, the server doesn't send any events any more. After refreshing the page (and this creating a new connection) it works, until the client sends the ping event.
Also, while receiving events, the client does not send a ping, but keeps receiving events.
Is this a bug I am running into or do I have something misconfigured?
Tried downgrading to 1.12.0 and there I don't experience the same experience but a proper experience.
@Thijmen The client only sends ping/pong after a period of inactivity is reached (defaults to 30 seconds). I suspect what is happening is, perhaps due to browser inactivity, the socket is paused, and once its resumed, it no longer receives any messages, other than ping/pong.
I am experiencing the same issue myself. Clearly, the socket is connected to server, since the ping-pong is working correctly. But once in that state, the browser no longer receives any other events. Refreshing the page resolves the issue, until it happens again.
Downgrading from 2.0.0-beta.36 -> 1.12.0 does seem to have resolved the issue.
So it really is a server-side bug, as the client javascript stays the same.
Did you set the "BROADCAST_DRIVER" in the .env file to pusher?
I can confirm my BROADCAST_DRIVER is set correctly, and that even with 2.0.0-beta.32, after a ping, no further event messages come through. What's interesting is that it's exactly 30 seconds after the last event, which tells me that it's not "ping interrupts something" it's "events stopped, client got worried, asked to ping after 30 seconds but already was never going to get events again"
I tried 2.0.0-beta.37 and I've managed to get updates consistently, so I suggest people try beta 37. I will say that the other site I have that doesn't have this issue is also running a 1.x version.
In fact, I just had the beta.37 version start sending pings when no events were flowing, I emitted an event, and it showed up and leads credence to my thoughts on how pings work here. I'll run beta.37 for a bit and report back if I notice this issue with it.