Fix off-by-one in first presence message
This commit is contained in:
parent
15009d07bc
commit
df03793047
1 changed files with 2 additions and 2 deletions
|
|
@ -23,12 +23,12 @@ const server = Bun.serve<WebsocketData>({
|
|||
open(ws) {
|
||||
// register newly connected client and tell them how many other people are there
|
||||
console.log('Connection opened', ws.data.clientId)
|
||||
clients.set(ws.data.clientId, ws)
|
||||
const enterNotice = JSON.stringify(<Message>{
|
||||
type: 'presence-information',
|
||||
others: clients.size,
|
||||
})
|
||||
for (const [uuid, client] of clients.entries()) {
|
||||
clients.set(ws.data.clientId, ws)
|
||||
for (const client of clients.values()) {
|
||||
client.send(enterNotice, true)
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue