admin管理员组

文章数量:1393167

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?

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?

Share Improve this question asked Mar 14, 2014 at 16:24 redcrowredcrow 1,8234 gold badges26 silver badges48 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

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

All major browsers support ping/pong.

There is no way of detecting the feature from JavaScript.

本文标签: How to detect if a browser supports pingpong frames in javascriptStack Overflow