Skip to content

if pong is slower than pongTimeout value, trigger pong_abnormal event; if pong is back to normal, trigger pong_normal event

Notifications You must be signed in to change notification settings

gunblues/socket.io-client-pongTimeout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

socket.io-client-pongTimeout

At bad network, you might want to show "the connection is unstable"

If pong response is slower than pongTimeout value, trigger error:pong_abnormal event; If pong response is back to normal, trigger error:pong_normal event

How to use

<script src="socket.io-pongTimeout-1.3.5.js"></script>
<script>
  //if you don't pass PongTimeout, the default value is 6000
  var socket = io('http://localhost', {pongTimeout: 5000});
  socket.on('error', function(info){
      if (info === 'pong_abnormal') {
        //do something
      } else if (info === 'pong_normal') {
        //do something
      }
  });
</script>

About

if pong is slower than pongTimeout value, trigger pong_abnormal event; if pong is back to normal, trigger pong_normal event

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published