mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
update interval/timeou
This commit is contained in:
@@ -3,6 +3,7 @@ import { QueryGetAPI, QueryPostAPI } from '@/api/query'
|
||||
import ChatClientDirectOpenLive from '@/data/chat/ChatClientDirectOpenLive.js'
|
||||
import { OPEN_LIVE_API_URL } from './constants'
|
||||
import { ref, toRef } from 'vue'
|
||||
import { setInterval, clearInterval } from 'worker-timers'
|
||||
|
||||
export interface DanmakuInfo {
|
||||
room_id: number
|
||||
@@ -182,7 +183,9 @@ export default class DanmakuClient {
|
||||
} else {
|
||||
console.warn('[OPEN-LIVE] 弹幕客户端未被启动, 忽略')
|
||||
}
|
||||
clearInterval(this.timer)
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer)
|
||||
}
|
||||
this.events = {
|
||||
danmaku: [],
|
||||
gift: [],
|
||||
@@ -191,7 +194,7 @@ export default class DanmakuClient {
|
||||
}
|
||||
private sendHeartbeat() {
|
||||
if (this.client) {
|
||||
;(this.authInfo ? QueryPostAPI<OpenLiveInfo>(OPEN_LIVE_API_URL + 'heartbeat', this.authInfo) : QueryGetAPI<OpenLiveInfo>(OPEN_LIVE_API_URL + 'heartbeat-internal')).then((data) => {
|
||||
(this.authInfo ? QueryPostAPI<OpenLiveInfo>(OPEN_LIVE_API_URL + 'heartbeat', this.authInfo) : QueryGetAPI<OpenLiveInfo>(OPEN_LIVE_API_URL + 'heartbeat-internal')).then((data) => {
|
||||
if (data.code != 200) {
|
||||
console.error('[OPEN-LIVE] 心跳失败: ' + data.message)
|
||||
this.client.stop()
|
||||
|
||||
Reference in New Issue
Block a user