messageReceiveStream method
Returns a stream to listen new messsage event with given channelUrl
.
It will be triggered every new message if channelUrl
is not provided
Implementation
Stream<BaseMessage?> messageReceiveStream({String? channelUrl}) async* {
if (currentUser == null) throw ConnectionRequiredError();
await for (final res in _int.streamManager.msgReceived.stream) {
if (channelUrl != null) {
if (res.channel.channelUrl == channelUrl) yield res.message;
} else {
yield res.message;
}
}
}