TencentCloudChat.EVENT.KICKED_OUT
,用户可在监听到事件后做相应处理。chat.login(options);
名称 | 类型 | 描述 |
userID | String | 用户 ID。 |
userSig | String |
Promise
let promise = chat.login({userID: 'your userID', userSig: 'your userSig'});promise.then(function(imResponse) {console.log(imResponse.data); // 登录成功if (imResponse.data.repeatLogin === true) {// 标识账号已登录,本次登录操作为重复登录。console.log(imResponse.data.errorInfo);}}).catch(function(imError) {console.warn('login error:', imError); // 登录失败的相关信息});
chat.logout();
Promise
let promise = chat.logout();promise.then(function(imResponse) {console.log(imResponse.data); // 登出成功}).catch(function(imError) {console.warn('logout error:', imError);});
chat.destroy();
Promise
let promise = chat.destroy();
TencentCloudChat.EVENT.KICKED_OUT
,用户可在监听到事件后做相应处理。let onKickedOut = function(event) {console.log(event.data.type);// TencentCloudChat.TYPES.KICKED_OUT_MULT_ACCOUNT(Web端,同一账号,多页面登录被踢)// TencentCloudChat.TYPES.KICKED_OUT_MULT_DEVICE(同一账号,多端登录被踢)// TencentCloudChat.TYPES.KICKED_OUT_USERSIG_EXPIRED(签名过期)// TencentCloudChat.TYPES.KICKED_OUT_REST_API(REST API kick 接口踢出)};chat.on(TencentCloudChat.EVENT.KICKED_OUT, onKickedOut);
本页内容是否解决了您的问题?