Why is there an intermittent delay in receiving channel_vacated and member_removed presence events and WebHooks?

This KB article is relevant if:
  • You are using channel existence WebHooks, you disconnect a client, the channel should be vacated but you don't see the channel_vacated WebHook for some time
  • You are using presence WebHooks, you disconnect a client and expect amember_removed WebHook but don't receive one for some time
  • Your application connection count is higher than expected after disconnecting users
 
Sometimes it's possible for a connection between a client to Pusher to only disconnect at the client side. This leads to something called a half-open connection. To work around this we have implemented a timeout where we detect half-open connections through lack of activity over a connection.
 
The timeout for inactive connections in Pusher is 200 seconds. After the 200 seconds a ping is sent and if a pong is not received within 30 seconds then the connection is cleaned up. This means that Pusher can indicate a connection is open for up to 230 seconds before cleaning up. This means that a connection count can be incorrect for this amount of time or the an expected WebHook call can be delayed for this amount of time.
 
What should I do to reduce the chances of this happening?
 
Version 1.11 of the Pusher JavaScript library introduced a ping/pong mechanism for detecting half-open connections. So, if you are using the Pusher JavaScript library it's recommended that you are at least on version 1.11.
 
We do highly recommend you use the latest version of the Pusher JavaScript library whenever possible.
 
 
Article also available here in the knowledge base.
Was this article helpful?
0 out of 0 found this helpful
Haven't found what you were looking for?
Submit a ticket