RoomConnection
Defined in: packages/engine/src/stores/roomConnection.ts:30
One client’s socket to its room. It queues what the room says rather than applying it, so the world changes only inside the loop’s frame; an answer to a ping, which changes no entity, it records as it lands, so a frame’s wait is not counted in the round trip.
Properties
Section titled “Properties”| Property | Modifier | Type | Description |
|---|---|---|---|
close |
public |
() => void |
- |
closed |
public |
boolean |
Whether the connection has closed for good: the room refused her, no socket opened for reconnectGiveUpSeconds, or the page closed it. |
messages |
readonly |
RoomMessage[] |
The room’s messages not applied yet, oldest first. The loop empties it each frame. |
receivedBytes |
public |
number |
The bytes those messages weighed, since the loop last took them. |
reconnecting |
public |
boolean |
Whether the room went away and the connection is trying it again, until a new welcome arrives. |
sendEdit |
public |
(edit) => void |
Sends a devtools edit, as a move is sent. |
sendMove |
public |
(move) => void |
Sends a move of her hero’s, once the socket is open and not while it rejoins. |
sendShot |
public |
(shot) => void |
Sends a shot, as a move is sent. |
sendWalk |
public |
(walk) => void |
Sends a walk of her hero’s, as a move is sent. A walk sent while she rejoins is gone, as a move is: the new room’s welcome places her. |