feat: Reduce pings and adds xmpp ping config (#1389)
* feat: Skips pinging when there was a recent server response.
* feat: Adds options to control xmpp ping settings.
* fix: Fixes wrong default value.
* squash: Received messages in ping interval sets failed ping to 0
The XmppConnection will try to resume the connection
only when the internet is online. This speeds up the process
by avoiding unnecessary connect attempts while offline as each
failed attempt increases the backoff delay.
fix(StropheLastSuccess): refresh the timestamp in connected
An 'item-not-found' or other error on Websocket reconnect will refresh
the timestamp which will give misleading information about when
the last stanza was received.
A new method which not only has Promise interface,
but also allows to queue IQs regardless of the current
connection's status.
Ping and send ICE failed notification requests are changed
to use this method which makes it more reliable on XMPP
Websocket connections on mobile(which in contrary to BOSH
dies much faster there).
ref(XmppConnection): enable XMPP resume by default if supported
The XMPP stream resumption will enable automatically if supported by
Prosody on Websocket connections. Pass the 'enableWebsocketResume'
config option set to 'false' to disable.
Websocket keep alive is HTTP GET request sent on the service URL passed
to Strophe. It is used to keep the stick tables alive. The feature comes
in enabled by default whenever Websocket are used. Pass
'websocketKeepAlive' config option set to -1 to disable.
See the code for more details about the default interval value.
fix(XmppConnection): use status instead of the connected field
The connected flag is flipped to true as soon as transport connection is
established by Strophe(such as WebSocket TCP), but it doesn't mean that
the connection is ready to send stanzas yet.
This prevents from accessing Strophe internals directly and allows to
block 'send' calls while disconnected. The latter breaks the stream
resume logic by putting stanzas onto the send queue.
TODO make jitsi strophe plugins use the XmppConnection wrapper whenever
possible instead of interacting with the Strophe.Connection directly.