No data
RtmChannel 实例上的事件类型。 该接口中,函数属性的名称为事件名称,函数的参数为事件监听回调的传入参数。
监听频道消息
channel.on('ChannelMessage', function (message, memberId) { // 你的代码:收到频道消息。 });
监听用户加入频道事件
channel.on('MemberJoined', memberId => { // 你的代码:用户已加入频道。 })
监听用户离开频道事件
channel.on('MemberLeft', memberId => { // 你的代码:用户已离开频道。 });
收到频道消息的事件通知。
接收到的频道消息对象。
该频道消息的发送者 uid。
收到用户加入频道的通知。
Note
加入频道的用户的 uid。
收到用户离开频道的通知。
用户调用 leave 方法离开频道或者由于网络原因与 Agora RTM 系统断开连接达到 30 秒都会触发此回调。
leave
当频道成员超过 512 时,该回调失效。
离开频道的远端用户的 uid。
RtmChannel 实例上的事件类型。 该接口中,函数属性的名称为事件名称,函数的参数为事件监听回调的传入参数。
监听频道消息
channel.on('ChannelMessage', function (message, memberId) { // 你的代码:收到频道消息。 });
监听用户加入频道事件
channel.on('MemberJoined', memberId => { // 你的代码:用户已加入频道。 })
监听用户离开频道事件
channel.on('MemberLeft', memberId => { // 你的代码:用户已离开频道。 });