mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-18 06:54:15 +00:00
Clean up sync room socket handling
This commit is contained in:
parent
0f70bf43fd
commit
5d3dbeb6da
@ -72,6 +72,8 @@ export default class SyncRoom {
|
|||||||
track_manifest = {
|
track_manifest = {
|
||||||
...currentItem.toSeriableObject(),
|
...currentItem.toSeriableObject(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete track_manifest.source
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if has changed the track
|
// check if has changed the track
|
||||||
@ -98,8 +100,6 @@ export default class SyncRoom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
syncState = async (data) => {
|
syncState = async (data) => {
|
||||||
console.log(data)
|
|
||||||
|
|
||||||
if (!data || !data.track_manifest) {
|
if (!data || !data.track_manifest) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -129,11 +129,12 @@ export default class SyncRoom {
|
|||||||
const currentTime = this.player.seek()
|
const currentTime = this.player.seek()
|
||||||
const offset = serverTime - currentTime
|
const offset = serverTime - currentTime
|
||||||
|
|
||||||
console.log({
|
this.player.console.debug("sync_state", {
|
||||||
|
serverPayload: data,
|
||||||
serverTime: serverTime,
|
serverTime: serverTime,
|
||||||
currentTime: currentTime,
|
currentTime: currentTime,
|
||||||
maxTimeOffset: SyncRoom.maxTimeOffset,
|
|
||||||
offset: offset,
|
offset: offset,
|
||||||
|
maxTimeOffset: SyncRoom.maxTimeOffset,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -182,13 +183,13 @@ export default class SyncRoom {
|
|||||||
this.state.joined_room = null
|
this.state.joined_room = null
|
||||||
|
|
||||||
if (this.socket) {
|
if (this.socket) {
|
||||||
await this.socket.disconnect()
|
await this.socket.destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createSocket = async () => {
|
createSocket = async () => {
|
||||||
if (this.socket) {
|
if (this.socket) {
|
||||||
await this.socket.disconnect()
|
await this.socket.destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.socket = new RTEngineClient({
|
this.socket = new RTEngineClient({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user