类名 VhallChat

方法

1.初始化接口

聊天对象初始化

    
    /**
     * 聊天对象初始化
     */
    var chat = new VhallChat({
        channelId:''//频道Id,必填
    });

  1. token生成方式:通过API生成,生成accessToken接口说明
  1. appId获取方式:登陆微吼云>>进应用管理>>取得对应AppId
  1. channelId获取方式:可以通过 【测试工具】 或 【API】 获得

2. on 监听聊天消息

注册消息监听事件,示例如下:

	/**
     * 监听聊天消息
     */
    chat.on(function(msg){
        //console.log(msg)
        //在此收到聊天消息,消息内容为msg
        //todo
    })

3. emit 发送聊天消息

	/**
     * 发送聊天消息
     */
    chat.emit("要发送的聊天消息内容");

4. onCustomMsg 监听自定义消息

	/**
     * 监听聊天消息
     */
    chat.onCustomMsg(function(msg){
        //console.log(msg)
        //在此收到自定义消息,消息内容为msg
        //todo
    })