mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 12:04:16 +00:00
use reauthenticate
This commit is contained in:
parent
791a42c020
commit
a1617c2e66
@ -94,11 +94,19 @@ export async function createWebsockets() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function reconnectWebsockets() {
|
export async function reconnectWebsockets({ force = false } = {}) {
|
||||||
const instances = globalThis.__comty_shared_state.wsInstances
|
const instances = globalThis.__comty_shared_state.wsInstances
|
||||||
|
|
||||||
for (let [key, instance] of Object.entries(instances)) {
|
for (let [key, instance] of Object.entries(instances)) {
|
||||||
if (instance.connected) {
|
if (instance.connected) {
|
||||||
|
if (!force) {
|
||||||
|
instance.emit("reauthenticate", {
|
||||||
|
token: SessionModel.token,
|
||||||
|
})
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// disconnect first
|
// disconnect first
|
||||||
instance.disconnect()
|
instance.disconnect()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user