fix(server): broadcast roster on plain connect and close (#88)
A reconnect with an existing name fires no intent, so the only roster the GM saw was the connecting connection's own resync; the row stayed offline while the player badge said Connected. Send the GM roster when a connection activates (skipping the connecting connection, which already got it in the 6.3 resync) and after a close, with the registry entry removed first so connected is recomputed. Also cover the server-initiated malformed-flood close. The setname ack-before-resync ordering is unchanged. Tests: WS connect/close/reconnect roster states; e2e GM row follows a player tab reload and close. protocol test updated for the extra roster on a second connection.
This commit is contained in:
@@ -43,8 +43,11 @@ test('hello is the first frame; n counts server frames per connection, never glo
|
||||
assert.equal((await other.waitText('roster')).n, 2)
|
||||
assert.equal((await other.waitText('walls')).n, 3)
|
||||
assert.equal((await other.request({ t: 'conn.ping', ts: 7 })).n, 4)
|
||||
// ... and the first connection's sequence did not move
|
||||
assert.equal((await gm.ws.request({ t: 'conn.ping', ts: 44 })).n, 6)
|
||||
// The second connection is a plain connect, so the first GM connection gets a roster with the
|
||||
// new `connected` state (6.1 roster) and its own counter advances by one.
|
||||
assert.equal((await gm.ws.waitFor(m => m.t === 'roster' && m.n === 6)).n, 6)
|
||||
// ... and the first connection's per-connection counter did not move with `other`'s.
|
||||
assert.equal((await gm.ws.request({ t: 'conn.ping', ts: 44 })).n, 7)
|
||||
for (const m of gm.ws.messages) assert.equal(typeof m.n, 'number', JSON.stringify(m))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user