Channel Events

channel:join

The channel:join event is sent to all connected clients where the associated user is added to a channel. This event will be triggered in the following circumstances:

  • The current user creates a new channel via the REST API
  • The current user joins a channel from a different device
  • The invite for a user is accepted

An example payload for this event:

{
  "event": "channel:join",
  "data": {
    "id": "2115543f-c236-4f81-a548-719b0929c465",
    "image_url": "https://images.voicelayer.io/display?path=d0426fad-f1eb-47b9-8722-4dfed0db1bb5&w=200&h=200"
    "name": "Some Channel",
    "has_name": true,
    "type": "broadcast",
    "public": false,
    "managed": true,
    "read": true,
    "write": true,
    "direct": false,
    "admin": false,
    "requested": false,
    "invited": false,
    "subscribe": true
  }
}

channel:update

The channel:update event is sent to all connected clients where the user has some involvement with the channel when the channel is updated. A user is considered involved in the following cases:

  • The user is a member of the channel
  • The user has received an invite to the channel but has not actioned the invite
  • The user has requested to join a channel but a channel admin has not actioned the request

An example payload for this event:

{
  "event": "channel:update",
  "data": {
    "id": "2115543f-c236-4f81-a548-719b0929c465",
    "image_url": "https://images.voicelayer.io/display?path=d0426fad-f1eb-47b9-8722-4dfed0db1bb5&w=200&h=200"
    "name": "Updated Channel",
    "has_name": true,
    "type": "broadcast",
    "public": false,
    "managed": true,
    "read": true,
    "write": true,
    "direct": false,
    "admin": false,
    "requested": false,
    "invited": false,
    "subscribe": true
  }
}

The payload shows the updated channel. All the fields above are sent regardless of if they have been updated.

channel:leave

The channel:leave event is sent to all connected clients where the user has some involvement with the channel when the channel is deleted. A user is considered involved in the following cases:

  • The user is a member of the channel
  • The user has received an invite to the channel but has not actioned the invite
  • The user has requested to join a channel but a channel admin has not actioned the request

After receiving this event, the connected clients will no longer receive any events (such as users leaving or messages being sent) for the channel as it no longer exists.) for the channel as it no longer exists.) for the channel as it no longer exists.) for the channel as it no longer exists.) for the channel as it no longer exists.) for the channel as it no longer exists.) for the channel as it no longer exists.) for the channel as it no longer exists.) for the channel as it no longer exists.

An example payload for this event:

{
  "event": "channel:leave",
  "data": {
    "id": "2115543f-c236-4f81-a548-719b0929c465",
  }
}