Watch channels
Use connect() to receive messages on a channel without joining as a member. The method subscribes to a message event listener and returns a function to disconnect.
Method signature
connect() returns an asynchronous stream producing a new value whenever someone sends a message on the given channel. This method takes the following parameters:
1channel.connect() -> AsyncStream<MessageImpl>
Input
This method doesn't take any parameters.
Output
| Parameter | Description |
|---|---|
AsyncStream<MessageImpl> | An asynchronous stream that emits a new value whenever a new message is published in the current channel. |
Sample code
Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
Start receiving messages on the support channel.
- AsyncStream
- Closure
1
1