Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Commit e7aaa35

Browse files
authored
fix: (comms) send heartbeat ASAP + firefox fix (#485)
* send heartbeat ASAP * bump comms3-transports
1 parent f7c1434 commit e7aaa35

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
},
7171
"dependencies": {
7272
"@dcl/catalyst-peer": "^1.0.4",
73-
"@dcl/comms3-transports": "^1.0.0-20220810153612.commit-883b9f5",
73+
"@dcl/comms3-transports": "^1.0.0-20220907164215.commit-622c7bf",
7474
"@dcl/crypto": "^3.1.1",
7575
"@dcl/ecs-math": "^1.0.1",
7676
"@dcl/ecs-quests": "^1.3.1",

packages/shared/comms/v3/InstanceConnection.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Position } from '../../comms/interface/utils'
77
import { BFFConnection, TopicData, TopicListener } from './BFFConnection'
88
import { TransportsConfig, Transport, DummyTransport, TransportMessage, createTransport } from '@dcl/comms3-transports'
99
import { createDummyLogger, createLogger } from 'shared/logger'
10-
import { lastPlayerPositionReport } from 'shared/world/positionThings'
10+
import { lastPlayerPositionReport, positionObservable } from 'shared/world/positionThings'
1111

1212
import { CommsEvents, RoomConnection } from '../../comms/interface/index'
1313
import { ProfileType } from 'shared/profiles/types'
@@ -65,7 +65,7 @@ export class InstanceConnection implements RoomConnection {
6565
}
6666
}
6767

68-
this.heartBeatInterval = setInterval(async () => {
68+
const heartBeat = async () => {
6969
const position = this.selfPosition()
7070
if (position) {
7171
const d = HeartbeatMessage.encode({
@@ -82,7 +82,11 @@ export class InstanceConnection implements RoomConnection {
8282
await this.disconnect()
8383
}
8484
}
85-
}, 2000)
85+
}
86+
87+
this.heartBeatInterval = setInterval(heartBeat, 2000)
88+
89+
positionObservable.addOnce(() => heartBeat())
8690

8791
this.islandChangedListener = await this.bff.addSystemTopicListener(
8892
`${peerId}.island_changed`,

0 commit comments

Comments
 (0)