Question

I have a websocket application in which the server (written in Java by using Netty) periodically sends ping frames to clients to detect if their connections are still alive (indeed it may happen that the client's network connection goes down and the server is not able to detect it). But what if a particular browser does not support the ping-pong function? How can I detect it in javascript? E.g., for websocket I use if(!window.WebSocket) {...}, but what about ping-pong?

Was it helpful?

Solution

A WebSocket client that does not support ping/pong is not compliant with RFC6455 - the feature is mandatory.

All major browsers support ping/pong.

There is no way of detecting the feature from JavaScript.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top