On this page

Watch / Unwatch channels

Use Connect() to receive messages on a channel without joining as a member. Use Disconnect() to stop receiving messages without leaving.

Watch a channel

Connect() subscribes to a channel. After connecting, the OnMessageReceived event is triggered when a message is received. Handle this event to receive messages.

Method signature

1channel.Connect()

Event signature

1public event Action<Message> OnMessageReceived;

Event handler signature

1void EventHandler(Message message)
* required
ParameterDescription
message *
Type: Message
Default:
n/a
The received message.

Output

This method doesn't return anything. To receive a message, you must handle the OnMessageReceived event.

Sample code

Start receiving messages on the support channel.

1

Unwatch a channel

Disconnect() lets users unwatch a given channel and its messages.

Method signature

1channel.Disconnect()

Output

This method doesn't return anything.

Sample code

Stop receiving messages from a channel after receiving the first message.

1

Last updated on