Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send channel message #21

Closed
rlee1990 opened this issue Jan 14, 2020 · 8 comments
Closed

Send channel message #21

rlee1990 opened this issue Jan 14, 2020 · 8 comments

Comments

@rlee1990
Copy link

Is it designed that the sender of the channel message does not receive the message also on the channel onMessageReceived listener?

@LichKing-2234
Copy link
Collaborator

yes, local can't receive the message, only remote, you can use resultCallback

@rlee1990
Copy link
Author

@LichKing-2234 I am not seeing resultCallback are you referring to channel.sendMessage(AgoraRtmMessage.fromText(msg)) if so it only returns a void.

@LichKing-2234
Copy link
Collaborator

your can try-catch

Future<void> sendMessage(AgoraRtmMessage message) async {
    final res = await _callNative("sendMessage", {'message': message.text});
    if (res["errorCode"] != 0) throw AgoraRtmChannelException("sendMessage failed errorCode:${res['errorCode']}", res['errorCode']);
  }

@rlee1990
Copy link
Author

@LichKing-2234 I am not following. Where are you getting _callNative from? or any of this.

@LichKing-2234
Copy link
Collaborator

this is method body of sendMessage

@rlee1990
Copy link
Author

@LichKing-2234 so are you saying wrap my channel.sendMessage(AgoraRtmMessage.fromText(msg)) in a try catch block?

@LichKing-2234
Copy link
Collaborator

yes, the catch mean sendMessage failed

@bst102user
Copy link

I am receiving message twice and next time 3 times any solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants