Current connection lifecycle state.
Which concrete transport is active.
Establish a connection to (or create) the specified room.
Room credentials and mode selection.
Resolves when the connection is ready to send and receive events.
Tear down the connection and release all resources.
Subscribe to incoming events.
Called for every event received.
An unsubscribe function — call it to stop receiving events.
Send an event to the other side of the connection.
Any TransportEvent variant.
WebRTC transport implemented via PeerJS.
Remarks
The host registers a deterministic PeerJS ID derived from the room code (
vkt-<roomId>). Players connect to that well-known ID. All data flows over WebRTC data channels with DTLS encryption provided by the browser.Connection topology:
Peerinstance listens for incoming connections; each connected player gets its ownDataConnectioninconnections.Peerinstance with a random ID; a single outboundDataConnectionto the host.The 8-second timeout on
connect()allows transport.TransportManager to fall back to transport/GunTransport.GunTransport in'auto'mode when the PeerJS signalling server is unreachable.