AgoraIO-Extensions / Agora-Flutter-RTM-SDK

Flutter wrapper around the Agora Real Time Message SDKs for Android and iOS
MIT License
106 stars 73 forks source link

Not receiving message from client or channel #157

Closed souravdivii closed 1 year ago

souravdivii commented 1 year ago

Hi, I am using the rtm sdk as suggested by littleGenAI in the Agora Video SDK repo. I have been able to create client then successfully login & also created the channel. The problem I am facing now is in the below code. I am not receiving any kind of message from client nor channel. Let me know if I am missing something.

void _sendMessageToRTM() async { try { RtmMessage? message = _client?.createRawMessage(Uint8List.fromList([]), 'share_screen'); if (message != null) { _log(message.text); await _channel?.sendMessage2(message); _log('Send channel message success'); }

  _client?.onMessageReceived = (RtmMessage message, String peerId) {
    _log("Peer msg: $peerId, msg: ${message.messageType} ${message.text}");
    _log('---> RTM Client Msg Received : ${message.text}');
  };

  _channel?.onMessageReceived =
      (RtmMessage message, RtmChannelMember member) {
    _log(
        "----> RTM Channel msg: ${member.userId}, msg: ${message.messageType} ${message.text}");
    _log('---> RTM Channel Message Received : ${message.text}');
  };
} catch (errorCode) {
  _log('----> RTM Send channel message error: $errorCode');
}

}

souravdivii commented 1 year ago

In the example it is shown how to send a message and the message sent is simply put into a controller and showed. It is nowhere showed how and where the channel receives the message. It is a pretty much a static send & show message code. Could you please show me where the channel is updated to receive the message send in _sendChannelMessage method ? Any help or guide is highly respected. Thanks.

souravdivii commented 1 year ago

I have resolved the issue, it was minor mistake. Hence, closing the thread.