How Can I Add A Cluster Failover Process to My Channels Integration?

Channels has no built in failover between clusters, however it is possible to implement a failover when required. Here we detail a common approach for this.

When the Channel client is initiated the app would request the relevant Pusher credentials from a server endpoint. This endpoint would respond with the credentials of the current primary cluster, for e.g mt1. Your server would publish to the same cluster and the system behaves as normal.

Then, if your system is aware of errors (through automatic monitoring or a manual failover has been initiated) it can begin returning credentials for another cluster (e.g us2 ) to any requests from clients. This would cause new clients to connect to the operation cluster. Your publishing server would also need to be updated to trigger events to both clusters, or the new cluster alone.

The above approach ensures any new connections are established to the failover cluster. You will also need to ensure existing connections are updated to migrate to the new cluster. One such method is to have your client routinely check with the server (at an interval that suits your use case) to see if the credentials have changed. To ensure this process is only invoked when required you can initiate this process after a set period of no events being received in a certain time window. This prevents your clients making unnecessary requests while the system is operation - but when events have not been received for a period of time you could initiate the request.

Still have questions? Please reach out to our Support team by visiting this page.

Last updated