|
@@ -39,7 +39,9 @@ export default {
|
|
|
await submitLogFn(request);
|
|
|
console.log(`${getNowDateTime()}:业务系统signal当前链接状态:${connection.state}`);
|
|
|
// 建议用户重新刷新浏览器
|
|
|
- await this.start();
|
|
|
+ setTimeout(async () => {
|
|
|
+ await this.start();
|
|
|
+ }, 1000);
|
|
|
});
|
|
|
connection.onreconnected(async () => {
|
|
|
const name: string = `业务系统websocket断线重连成功`;
|
|
@@ -61,15 +63,15 @@ export default {
|
|
|
});
|
|
|
// 服务端推送消息
|
|
|
connection.on('Send', (message: any) => {
|
|
|
- console.log(`${getNowDateTime()}:有用户加入分组:`,message);
|
|
|
+ console.log(`${getNowDateTime()}:有用户加入分组:`, message);
|
|
|
});
|
|
|
// 服务端推送消息
|
|
|
connection.on('CircularRecord', (message: any) => {
|
|
|
- console.log(`${getNowDateTime()}:小红点消息:`,message);
|
|
|
+ console.log(`${getNowDateTime()}:小红点消息:`, message);
|
|
|
});
|
|
|
// 服务端推送消息
|
|
|
connection.on('SeatState', (message: any) => {
|
|
|
- console.log(`${getNowDateTime()}:座席状态:`,message);
|
|
|
+ console.log(`${getNowDateTime()}:座席状态:`, message);
|
|
|
});
|
|
|
// 服务端推送消息
|
|
|
connection.on('RestApplyPass', (message: any) => {
|
|
@@ -199,14 +201,18 @@ export default {
|
|
|
* @returns
|
|
|
*/
|
|
|
async leaveAllGroupAndStop() {
|
|
|
- try {
|
|
|
- //使用async和await 或 promise的then 和catch 处理来自服务端的异常
|
|
|
- await this.leaveGroup('CallCenter');
|
|
|
- await this.leaveGroup('BigScreen-SeatState');
|
|
|
- await this.stop();
|
|
|
- console.log(`${getNowDateTime()}:断开链接:${this.SR.state}`);
|
|
|
- } catch (error) {
|
|
|
- console.log('signalR', error);
|
|
|
- }
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
|
+ try {
|
|
|
+ //使用async和await 或 promise的then 和catch 处理来自服务端的异常
|
|
|
+ await this.leaveGroup('CallCenter');
|
|
|
+ await this.leaveGroup('BigScreen-SeatState');
|
|
|
+ await this.stop();
|
|
|
+ console.log(`${getNowDateTime()}:断开链接:${this.SR.state}`);
|
|
|
+ return resolve(true);
|
|
|
+ } catch (error) {
|
|
|
+ console.log('signalR', error);
|
|
|
+ return reject(error);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
};
|