Doubt in the Sendbird API to create a chat

Asked

Viewed 42 times

0

Good evening, everyone,

I’m doing a little project and I’m using the Sendbird API to create a chat, however I’m finding problems when receiving the message that was sent from one user to another, could you help me? Below is the code to receive the message

public partial class MainPage : ContentPage
{
    public MainPage()
    {
        InitializeComponent();

        //passa o token de conexão para o programa
        SendBirdClient.Init(APP_ID);

        //esse 1 é o id do usuário que está cadastrado na minha deshboard
        SendBirdClient.Connect("1", (User user, SendBirdException e) =>
        {
            if (e != null)
            {
                // Error
                return;
            }
            else
            {
                //Receber mensagens
                GroupChannel.GetChannel("sendbird_group_channel_67663307_ced62c9c4460ceb0db9d26297e2528617d883552", (GroupChannel groupChannel, SendBirdException ex3) =>
                {
                    if (e != null)
                    {
                        // Error!
                        return;
                    }

                    // Successfully fetched the channel.
                    // Do something with groupChannel.
                    else
                    {
                        SendBirdClient.ChannelHandler ch = new SendBirdClient.ChannelHandler();
                        ch.OnMessageReceived = (BaseChannel baseChannel, BaseMessage baseMessage) =>
                        {
                            // Received a chat message

                        };
                        SendBirdClient.AddChannelHandler(UNIQUE_HANDLER_ID, ch);
                    }
                });

            }
        });
    }
}
  • What problem is occurring? It seems that the message will arrive in ch.OnMessageReceived

  • I am unable to display the result of this line in a string for example to be able to use in my application, I also thought that ch.Onmessagereceived was the message only to realize that it is commented within it "Received a chat message"to understand that it is to catch the result of the message there

  • Do this test: You put a breakpoint on this line, and the breakpoint is hit?

  • Yes, I just did, I looked for any expected results within the breakpoint methods and found nothing :/

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.