Transport
The Transport layer is responsible for handling the low-level network communication between the Colyseus server and clients. It manages WebSocket connections, handles ping/pong heartbeats to detect disconnected clients, and provides the underlying HTTP server for the application.
Available Transports
Node.js Runtime
Bun Runtime
Each Transport implementation has its own set of options for customization.
Connection Lifecycle
When a client connects to the server, the transport layer:
- Accepts the WebSocket connection
- Starts heartbeat monitoring (ping/pong) to detect unresponsive clients
- Parses the connection URL for
sessionId,roomId, and authentication tokens - Forwards the connection to the appropriate room via
matchMaker