mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
update heartbeat check
This commit is contained in:
@@ -152,6 +152,23 @@ function updateUsers() {
|
|||||||
}
|
}
|
||||||
async function start() {
|
async function start() {
|
||||||
if (!chatClient) {
|
if (!chatClient) {
|
||||||
|
await connectRoom()
|
||||||
|
isConnected.value = true
|
||||||
|
setInterval(() => {
|
||||||
|
if (chatClient) {
|
||||||
|
QueryPostAPI<OpenLiveInfo>(OPEN_LIVE_API_URL + 'heartbeat', authInfo.value).then((data) => {
|
||||||
|
if (data.code != 200) {
|
||||||
|
console.error('[OPEN-LIVE] 心跳失败: ' + data.message)
|
||||||
|
chatClient.stop()
|
||||||
|
chatClient = null
|
||||||
|
connectRoom()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, 20 * 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function connectRoom() {
|
||||||
const auth = await get()
|
const auth = await get()
|
||||||
if (auth) {
|
if (auth) {
|
||||||
authResult.value = auth
|
authResult.value = auth
|
||||||
@@ -159,11 +176,6 @@ async function start() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
initChatClient()
|
initChatClient()
|
||||||
isConnected.value = true
|
|
||||||
setInterval(() => {
|
|
||||||
QueryPostAPI<OpenLiveInfo>(OPEN_LIVE_API_URL + 'heartbeat', authInfo.value)
|
|
||||||
}, 20 * 1000)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
async function initChatClient() {
|
async function initChatClient() {
|
||||||
chatClient = new ChatClientDirectOpenLive(authResult.value)
|
chatClient = new ChatClientDirectOpenLive(authResult.value)
|
||||||
|
|||||||
Reference in New Issue
Block a user