AgoraIO/agora-react-native-rtm

Don't have createChannel method in 1.2.2-alpha.6

williamzhenyu opened this issue · 5 comments

Every other library documentations needs to have createChannel called before allowing to perform other channel related functions.

RTM Web
const channel = client.createChannel('demoChannelName'); // Pass your channel ID here.

RTM Android
mRtmChannel = mRtmClient.createChannel("demoChannelId", mRtmChannelListener);

Even tho react-native-rtm@1.2.2-alpha.6 has joinChannel, leaveChannel methods, it doesn't have createChannel method. Am I on the correct library?

@williamzhenyu i guess joinChannel is equivalent to create and join.

@plutoless It's not, I'm having issue joining a channel and sending message to channel here's what I've done so far:

  1. use {{createInstance(appId)}} to create an Agora RTM instance

    await this.rtm_engine.createInstance(appId)

  2. log into agora RTM instance using {{this.rtm_engine.LoginV2(uid, token)}}

    await this.rtm_engine?.loginV2(uid, token)

  3. add listener
    this.rtm_engine?.addListener('ChannelMemberJoined',(member) => {
    console.log("channelMemberJoined ", member);
    });

4)Tried to join channel, but I can't because I don't think I've created an agoraRTM channel.
await this.rtm_engine.joinChannel(channelId)

Other libraries have something like this before joining channel
const channel = client.createChannel('demoChannelName'); // Pass your channel ID here.

Now when I go run my code, step 4 gets stuck. the step 3 never gets to console log.

then joinChannel method is equivalent to create and join.
the ChannelMemberJoined event means remote user joins. if the Promise did not throws an error, means join channel success.

@LichKing-2234
That makes sense. It's working now thank you. But for sending message, is my sendMessage written correctly?

await this.rtm_engine?.sendMessage("09bff812-8276-4882-bd62-505d876ec94b", 'hi im sending message from RTM')

My ChannelMessageReceived listener didn't respond when I sent a message through this method, but it did when I sent it through a deprecated method

await this.rtm_engine?.sendMessageByChannelId("09bff812-8276-4882-bd62-505d876ec94b", 'hi im sending message from RTM')

pls refer to

your params are invalid.