Skip to content

Commit

Permalink
Merge pull request #22 from SlimeVR/feat/tracker-emulation-specify-se…
Browse files Browse the repository at this point in the history
…rver

feat(tracker-emulation): allow specifying the server IP and port
  • Loading branch information
TheDevMinerTV authored Jun 3, 2024
2 parents e06fb54 + 0ec929e commit 4129f62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-bees-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@slimevr/tracker-emulation': patch
---

allow specifying the server IP and port
12 changes: 6 additions & 6 deletions packages/tracker-emulation/src/EmulatedTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ export class EmulatedTracker extends (EventEmitter as {
private readonly firmware: string,
private readonly featureFlags: FirmwareFeatureFlags,
private readonly boardType: BoardType = BoardType.UNKNOWN,
private readonly mcuType: MCUType = MCUType.UNKNOWN
private readonly mcuType: MCUType = MCUType.UNKNOWN,
private readonly serverDiscoveryIP = '255.255.255.255',
private readonly serverDiscoveryPort = 6969
) {
super();

this.socket = createSocket('udp4');
this.socket.on('message', (msg, addr) => this.handle(msg, addr));
this.socket.on('error', (err) => this.emit('error', err));

this.state = {
status: 'initializing'
};
this.state = { status: 'initializing' };

this.on('connected-to-server', async () => {
await this.sendPacketToServer(new ServerBoundFeatureFlagsPacket(this.featureFlags));
Expand Down Expand Up @@ -114,8 +114,8 @@ export class EmulatedTracker extends (EventEmitter as {
this.firmware,
this.mac
),
6969,
'255.255.255.255'
this.serverDiscoveryPort,
this.serverDiscoveryIP
);
}

Expand Down

0 comments on commit 4129f62

Please sign in to comment.