News for hackers. Stuff that matters.
Re:You might not need WebSockets by throwaway2037 on Friday April 11, 2025 @11:26PM (#43661079)
I have only small experience programming with web sockets, but I thought the ping pong mechanism is already built into the protocol. Does it have timeout? Does it help at the application layer?

Ref: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_...

Re:You might not need WebSockets by copperroof on Friday April 11, 2025 @11:44PM (#43661155)
You only need to implement it yourself if you’ve catastrophically fucked up the concurrency model on the client or sever side and they can’t respond out of band of whatever you’re waiting on.
Re:You might not need WebSockets by koakuma-chan on Friday April 11, 2025 @11:57PM (#43661225)
Discord implements its own heartbeat mechanism. I've heard websocket-native ping is somehow unreliable. Maybe in case the websocket connection is fine but something happened at the application layer?
Re:You might not need WebSockets by jand on Saturday April 12, 2025 @04:05AM (#43662387)
"Unreliable" is a bit harsh - the problem arises imho not from the websocket ping itself, but from the fact that client-side _and_ server-side need to support the ping/pong frames.
Re:You might not need WebSockets by apitman on Saturday April 12, 2025 @11:39PM (#43669920)
The WebSocket browser APIs don't support ping/pong