Giter VIP home page Giter VIP logo

Comments (2)

maryrosecook avatar maryrosecook commented on June 2, 2024

Thanks a lot for reporting this. I'll look into it.

from pusher-js.

maryrosecook avatar maryrosecook commented on June 2, 2024

Hi Dumitru,

Thanks again for reporting this. I've looked into it. Using Google Chrome 18 and Windows 7, I was able to reproduce this behaviour intermittently. The short answer: in cases when the connection says it is connected but is not, we have a special ping/pong functionality that will resolve the situation. Are you using version 1.11.0 or higher? If so, you should be all set.

The JavaScript library periodically pings our servers. If it doesn't get a response, it will close the socket which will update the connection state to the correct value. The default wait for sending a ping is 120 seconds. If you want to have the situation corrected more rapidly, you can override the Pusher.activity_timeout by specifying a value for activity_timeout in the options object you pass when you instantiate the Pusher object.

The longer answer:

There is a browser API called window.navigator.onLine that we use to try and detect a dropped connection as quickly as possible. This works by the browser updating the .onLine status and emitting an online or offline event as soon as it detects that the program's connection to the internet has been dropped or opened. However, this API is not very reliable. In some browsers, it is not implemented at all. In the browsers in which it is implemented, .onLine being true can indicate only a connection to the local router, or even be just plain wrong.

from pusher-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.