OnMessageReceived called multiple times

I’m wondering what I’m doing wrong here or if this is the intended behavior.

I have added 3 event handlers using the code below for 3 unique (isDistinct) channels. Each channel has it’s own event handler registered with a unique channelId.

SendbirdSdk().addChannelEventHandler(chatChannel.channelId, this);

When I send a message using the code below it is received on every registered event handler, so it is received 3 separate times. I would have thought that the message would only be received once, on the event handler that was registered with the channels associated channelId?

void sendMessage(sb.GroupChannel groupChannel, String message, VoidCallback onSend) {
    try {
        sb.UserMessageParams(message: message),
        onCompleted: ((message, error) => {
    } catch (e) {
      // Handle error.

Hello @peter,

I think you may have a slight misunderstanding on how the event handlers work. The unique_id that you’re passing in, has nothing to do with the channel. It is purely used as a way to identify that specific handler, in the event that you want to delete it later on.

If you’ve registered the onMessageReceived event, in three different handlers, then it is expected that it would be triggered in all three handlers.

Thank you @Tyler appreciate the clarification, apologies for my misunderstanding.