How can I alert a user to subscribe to a channel?

The following is an explanation of how you can alert a user to subscribe to a channel such as a Direct Message (DM) or group chat. This is built around the principle of using a notification channel per user. Please follow the below for additional instructions:

  • A user joins and connects to your publishing channel and your notifications/control channel. Both of these are based off an ID such as the clientID.
  • As a user DM’s another, the server creates this DM channel for any number of people. Then the users that have been DM’ed receive a signal to join this channel through your notification channel.
  • The join is done with rewind to enable the user to connect seamlessly to the flow of messages. The clients are then subscribed to this new DM (or group) channel that has all of the usual properties including history, encryption, audit trail etc.
  • To make this robust, the list of all of the channels a user is active on needs to be maintained server side. Presence in a channel can be used to know whether or not to send another join channel signal from the server. This allows your client to disconnect from quiet channels and be reconnected if someone messages again.

For further details on authentication, please see here, and this FAQ article for details on how to set permissions for direct/private messages.