# 频道管理
# 1. 通话内消息
通过调用 SendConferenceMessage 方法发送通话内的消息。
示例代码:
var webPlugin = new WebPlugin();
/**
* @desc 发送通话内消息,必须在通话内
* @param {string} type - 消息类型
* @param {string} content - 内容
*/
webPlugin.SendConferenceMessage("type","content");
发送通话内消息结果:
var webPlugin = new WebPlugin();
/**
* @desc 发送通话内消息结果
* @param {boolean} result - 是否成功
* @param {string} content - 消息内容
* @param {string} reason - 原因
* @param {string} messageId - 消息唯一id
*/
webPlugin.OnConferenceMessageSendResult = function (result, content, reason, messageId) {
console.log('OnConferenceMessageSendResult', result, content, reason, messageId);
};
通话内其他成员发送透明通道消息,通过 OnConferenceMessageRecvNotify 回调接收。
var webPlugin = new WebPlugin();
/**
* @desc 收到通话内消息
* @param {string} type - 类型
* @param {string} content - 消息内容
* @param {string} userId - 发送方id
*/
webPlugin.OnConferenceMessageRecvNotify = function (type, content, fromUserId) {
console.log('OnConferenceMessageRecvNotify', type, content, userId);
};
# 2. 文本消息
通话内成员间文本消息通信。
var webPlugin = new WebPlugin();
/**
* @desc 发送通话内消息,必须在通话内
* @param {string} type - 消息类型
* @param {string} content - 内容
*/
webPlugin.SendTextConferenceMessage('type', '你好')
收到消息回调:
var webPlugin = new WebPlugin();
/**
* @desc 收到会议文字消息
* @param {string} content - 消息内容
* @param {string} fromUserId - 发送方id
* @param {string} fromDisplayName - 发送方昵称
*/
webPlugin.OnTextConferenceMessageRecvNotify = function(content, fromUserId, fromDisplayName) {
console.log('OnTextConferenceMessageRecvNotify', content, fromUserId, fromDisplayName);
};
# 3. 在线消息
用户在登录后即可与指定用户进行消息的发送。
var webPlugin = new WebPlugin();
/**
* @desc 发送在线消息,对方必须在线才能收到消息
* @param {string} userId - 用户id
* @param {string} content - 内容
*/
webPlugin.SendOnlineMessage(userId, content);
发送消息结果:
var webPlugin = new WebPlugin();
/**
* @desc 发送在线消息结果
* @param {boolean} result - 是否成功
* @param {string} content - 消息内容
* @param {string} messageId - 消息唯一id
*/
webPlugin.OnOnlineMessageSendResult = function (result, content, messageId) {
console.log('OnOnlineMessageSendResult', result, content, messageId);
};
收到在线消息通知:
var webPlugin = new WebPlugin();
/**
* @desc 收到在线消息
* @param {string} content - 消息内容
* @param {string} userId - 发送方id
*/
webPlugin.OnOnlineMessageRecvNotify = function (content, userId) {
console.log('OnOnlineMessageRecvNotify', content, userId);
};
# 4. 插件消息透传
# 给插件发送消息
/**
* 发送 websocket 消息给插件
* @param message 消息 object
* @constructor
*/
webPlugin.SendWsMessage(message);
# 收到插件的消息
webPlugin.OnWsMessage = function(message) {
}