GithubHelp home page GithubHelp logo

Comments (6)

Gordin avatar Gordin commented on July 28, 2024

I'm guessing Gordin/strophejs@a1f13b2 would fix this?

from strophejs.

samaxes avatar samaxes commented on July 28, 2024

Yes, probably.

Would the disconnect sequence be something like this?

connection.sync = true;
connection.send(new $pres({
    type: 'unavailable'
}));
connection.flush(); // Is this mandatory?
connection.disconnect();

from strophejs.

Gordin avatar Gordin commented on July 28, 2024

If you want to disconnect in a window close callback You would do

connection.options.sync = true;
connection.disconnect();
connection.flush();

disconnect automatically sends an unavailable presence and flush will make sure everything will be sent instantly.
If you just want to reconnect you should be able to just do

connection.disconnect();

and wait until the Connection Callback receives a DISCONNECTED before you reconnect. If this only works with synchronous connections, there maybe is a bug in the BOSH disconnect logic.

from strophejs.

samaxes avatar samaxes commented on July 28, 2024

I was expecting that the sync option would allow us not having to wait for the DISCONNECTED status.
When reconnecting after DISCONNECTED it works fine, there is no bug on the BOSH disconnect logic.

from strophejs.

Gordin avatar Gordin commented on July 28, 2024

Why exactly would you want to reconnect before DISCONNECTED? If you reconnect before DISCONNECTED the connection might not be fully cleaned up (although you will probably be fine if you call reset before reconnecting). Waiting for DISCONNECTED is definitely the way it's supposed to work. Also, it shouldn't take too long to wait for it either, worst case is 3 seconds after which a disconnect timeout triggers.

from strophejs.

samaxes avatar samaxes commented on July 28, 2024

For no reason in particular :)

from strophejs.

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.