GithubHelp home page GithubHelp logo

Comments (9)

akarelas avatar akarelas commented on July 28, 2024

After some console.log's I discovered that the connection object became null, without having passed from DISCONNECTED state first. That's bad, because I wanted the DISCONNECTED state in order to launch a "reconnect" timeout.

from strophejs.

akarelas avatar akarelas commented on July 28, 2024

I think this is a bug. It looks like one anyway.

from strophejs.

Gordin avatar Gordin commented on July 28, 2024

When you use WebSockets Strophe actually doesn't use any kind of timeout, the connection should just stay open if there is no traffic, so I think your server does the timeout-thingy.

I've used Prosody while developing WebSocket support and if I shut it down while being connected this happens:

WebSocket stream error: system-shutdown - Received SIGTERM
Status change: ERROR
_doDisconnect was called
WebSockets _doDisconnect was called
Status change: DISCONNECTED
Websocket closed

This is what should happen, the StreamError basically bypasses the DISCONNECTING stage because at this point there is no connection any more to gracefully disconnect. In case of a StreamError, Strophe goes directly to the DISCONNECTED stage because of this.

However if I SIGKILL my XMPP server though I just get

Websocket closed

You're right about this being a bug, it should go to DISCONNECTED, I'll look into this. Though this only happens if the XMPP Server crashes or does not handle WebSocket connections right. Which XMPP Server (and/or WebSocket Proxy) are you using?
edit: it should go to DISCONNECTED, not DISCONNECTING

from strophejs.

akarelas avatar akarelas commented on July 28, 2024

I'm using my own Jabber server, KJabberd, that has an embedded Websocket listener, and which is not-yet-released, neither is it production-ready. I use Ubic to launch/stop it (I think Ubic sends SIGKILL). I'm very glad you managed to reproduce the bug. Other than this, I've had zero problems with Strophe over webcoskets. When you fix this, it will be great. Thanks.

from strophejs.

akarelas avatar akarelas commented on July 28, 2024

Actually the maker of ubic just told me that it sends SIGTERM, and after 10 seconds if that had failed it also sends a SIGKILL.

from strophejs.

akarelas avatar akarelas commented on July 28, 2024

In my case I didn't have to wait more than 1 second, so SIGTERM worked (Strophe didn't "get" the disconnection though). Of course it's my job as maker of KJabberd to process SIGTERM properly, however it would be nice if Strophe got into DISCONNECTED state even after a server crash (which could in theory happen).

from strophejs.

Gordin avatar Gordin commented on July 28, 2024

The status not being set on a killed WebSocket connection should be fixed now. I think kjabberd does not handle WebSocket connections right. If you shut the server down in should at least send a streamerror to connected clients. What you describe sounds like your server doesn't do that.

from strophejs.

akarelas avatar akarelas commented on July 28, 2024

I am going to fix this on KJabberd. There is plenty of such little stuff that needs to be done.

from strophejs.

akarelas avatar akarelas commented on July 28, 2024

The 60 seconds timeout was nginx's problem. And why is this bug not closed yet?

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.