Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
v0.8 channel attach example
function reattach(channel) {
/* Example when using presence on the channel */
/* Connection state changes can trigger channels to become detached
Automatically re-attach channels, nothing will happen if already attached */
client.connection.on('connected', function() {
for (let channelName in client.channels.all) {
let channel = client.channels.get(channelName);
/* If a channel becomes detached due to channel failure (some edge cases exist)
You should explicitly re-attach the channel if you are connected */
channel.on('detached', function() {
if (client.connection.state === 'connected') {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.