我将SDK的初始化和登录放在了app.js中
具体:
初始化 JMessage#init()
登录JMessage#login()
之后就可以加入聊天室,发送消息,监听消息了
大概流程:
进入聊天室JMessage#enterChatroom ()
聊天室发送文本消息
JMessage#sendChatroomMsg()
聊天室消息监听
JMessage#onRoomMsg(fn)
注意
聊天室消息监听只能监听别人发送的聊天室信息,自己发送的文本在聊天室发送文本消息JMessage#sendChatroomMsg()的回调函数中
具体参考极光AIP:极光AIP.