leave event trigger when a client disconnects from a channel?
Not necessarily, since PubNub detects a
leave event when an outstanding http request is closed (i.e. not when a connection is closed). To ensure a
leave event triggers, the client can issue a new subscribe request just prior to disconnecting from the channel. In general,
leave events work as follows:
joinevent triggers when the first subscribe http request completes (typically with timetoken 0) which returns immediately with the current timetoken. Subscribing with timetoken > 1000 will block until the first message is received on that channel and then the
- PubNub servers don't always notice a network loss or other non-graceful disconnects, hence no
leaveevent is fired. Instead, a
timeoutevent is fired after the 320 second period is elapsed.