xmppjs / xmpp.js

XMPP for JavaScript
ISC License
2.18k stars 372 forks source link

add disableStreamManagement option #897

Closed sylvainleris closed 2 years ago

sylvainleris commented 3 years ago

In some case, ejabberd close connection with this message : "Too many unacked stanzas". This appears when huge number of users send "subcribe" stanzas and then @xmpp/client has not enough time to "ack" the stanza. So, in order not to update ejabberd server configuration (increase max_ack_queue or disabled it), we can simply add boolean disableStreamManagement to force disabling XEP-0198 directly in the client.

jonathanve commented 3 years ago

Yes, adding a disableStreamManagement option would be great

sonnyp commented 3 years ago

In general I am not in favor of adding configuration options to @xmpp/client It is meant to be a ready to use standard client that just works.

If the default configuration doesn't work in standard/federated network then I'd rather address it as a bug.

Otherwise I'd suggest using @xmpp/client-core and include what you need see https://github.com/xmppjs/xmpp.js/blob/master/packages/client/index.js

sonnyp commented 3 years ago

I'd suggest looking at prior art here and see how clients behave after receiving this error.

jonathanve commented 3 years ago

Any xmpp library I have used (Smack, XMPP Framework, etc.) provides a way to define which extensions to enable/disable. By default, it's good that SM is enabled. However, there are cases when one wants to disable certain extensions. The choice should be given

sonnyp commented 3 years ago

@jonathanve please take the time to read and understand my comment. That choice is given - use @xmpp/client-core.

If that doesn't work for you, open a separate issue with your use case.

sylvainleris commented 3 years ago

I'd suggest looking at prior art here and see how clients behave after receiving this error.

The problem is the server close the connection after "Too many unacked stanzas" message. After that, client connects again, but not respond fast enough, so, the server close the connection again.

sonnyp commented 3 years ago

The problem is the server close the connection after "Too many unacked stanzas" message. After that, client connects again

Ok so far so good :+1: working as expected (as far as xmpp/client is concerned)

but not respond fast enough

Can you elaborate?

Why not and respond to what?

jonathanve commented 3 years ago

great, I'll test with @xmpp/client-core

sonnyp commented 2 years ago

https://github.com/xmppjs/xmpp.js/pull/897#issuecomment-864129215

Feel free to comment if you can share more information about what is going on in case you believe xmpp.js is misbehaving.