Skip to content

Commit

Permalink
Make the first connection the main connection
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Boberg <[email protected]>
  • Loading branch information
axelboberg committed Mar 9, 2024
1 parent 533baa9 commit f6f4149
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/SocketHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ class SocketHandler extends EventEmitter {
this.state.apply({
_connections: {
[id]: {
...this.state.data[id]
...this.state.data[id],

/*
Make this the main connection
if it's the only one connected
*/
...(Object.values(this.state?.data?._connections || {}).length === 0 ? { role: 1 } : {})
}
}
})
Expand Down

0 comments on commit f6f4149

Please sign in to comment.