Comments (9)
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.
I think this is a bug. It looks like one anyway.
from strophejs.
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.
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.
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.
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.
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.
I am going to fix this on KJabberd. There is plenty of such little stuff that needs to be done.
from strophejs.
The 60 seconds timeout was nginx's problem. And why is this bug not closed yet?
from strophejs.
Related Issues (20)
- React Native / iOS WebSocket onopen not callback,why? HOT 2
- [Feature] Have a "real" ESM support HOT 3
- Broken dependencies in React HOT 5
- Report the "from" attribute of the opening <open /> tag HOT 1
- addHandler 'stream:error' can not receive message HOT 2
- XEP-0237 is Obsolete, It is preferable to use it in production system, If not then is there any alternate available? HOT 5
- Uncaught TypeError: (o, strophe_WEBPACK_IMPORT_MODULE_1.$msg) is not a function HOT 1
- Websocket disconnect broken
- strophe > 1.5.0 no longer works in React Native HOT 4
- TypeError: XHTML.validTag is not a function
- video calls HOT 1
- When chatting in multiple groups, Message loss
- When chatting in multiple groups, Message loss HOT 4
- Invalid Token with OAuth HOT 1
- SCRAM-SHA-1-PLUS + SCRAM-SHA-256-PLUS + SCRAM-SHA-512-PLUS + SCRAM-SHA3-512(-PLUS) supports
- TypeError: Cannot read properties of null (reading 'send')
- How to send raw xml string over the connection ?
- Detach old upstream HOT 3
- How to resume a stream as specified in XEP-0198 Stream management ?
- New release build? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strophejs.