Skip to content

Commit

Permalink
fix: 金十数据因为ws问题引起重连卡顿
Browse files Browse the repository at this point in the history
close #447
  • Loading branch information
giscafer committed Jul 14, 2024
1 parent 32e2d5f commit 86e5e9e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/output/flash-news/impl/Jin10FlushService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class Jin10FlushService extends NewsFlushServiceAbstractClass {
this.ws.close();
this.ws = void 0;
}
const ws = new WebSocket('wss://wss-flash-1.jin10.com/');
const ws = new WebSocket('wss://wss-flash-2.jin10.com/');
this.ws = ws;
ws.binaryType = 'arraybuffer';
ws.addEventListener('message', (msg: { data: Iterable<number> }) => {
Expand All @@ -44,14 +44,14 @@ export default class Jin10FlushService extends NewsFlushServiceAbstractClass {

ws.addEventListener('error', (err: any) => {
globalState.telemetry.sendEvent('error:jin10Service', { error: err });
console.log('金十快讯 ws 错误:', err);
console.log("🚀 ~ 金十快讯 ws 错误:Jin10FlushService ~ ws.addEventListener ~ err:", err)
});

ws.addEventListener('close', () => {
console.log('金十快讯 ws 关闭');
if (!this.isDone) {
this.ws = void 0;
this.init();
setTimeout(() => this.init(), 10000);
}
});
}
Expand All @@ -61,7 +61,7 @@ export default class Jin10FlushService extends NewsFlushServiceAbstractClass {
this.heartbeatTimer && clearInterval(this.heartbeatTimer);
this.ws?.close();
}
pause() {}
pause() { }
private sendHeartbeat() {
this.heartbeatTimer = setInterval(() => {
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
Expand Down

0 comments on commit 86e5e9e

Please sign in to comment.