문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top