最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to detect if a browser supports ping-pong frames in javascript? - Stack Overflow

programmeradmin1浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论