How do I detect a disconnected session with Strophe.js?
-
26-02-2021 - |
سؤال
Assuming long chat conversations, the connection between Jabber chat clients is likely to get disconnected eventually.
How does one go about detecting that a connection from a Strophe.js based jabber client?
المحلول
Strophe manages connection status changes through events. There appears to be no easy way to query the status of a given connection, but it's fairly straight forward to keep track of it.
The "connect" message on a Strophe.Connection takes a function, which will then be called on any connection status change. Keep track of current status within that function.
لا تنتمي إلى StackOverflow