swamp library

Swamp Server Dart library

Classes

ConfigManager
Manages the runtime configuration of the server.
RateLimiterPipe<T>
RoomInfo
Information about a room, including its configuration and state.
RoomProgram
RoomsProgram
StopProgram
SwampConfig
SwampConfigCopyWith<$R, $In extends SwampConfig, $Out>
SwampConfigMapper
SwampRoom
Represents a room/lobby in the Swamp server.
SwampRoomManager
Manages the lifecycle and operations of rooms on the server.
SwampServer
The main Swamp server class.

Enums

CreationFailedReason
JoinFailedReason
KickReason
SwampCommand
Commands sent from the client to the server.
SwampEvent
Events sent from the server to the client.

Mixins

SwampConfigMappable

Extension Types

RoomFlags
Flags configuring the behavior of a room.

Extensions

SwampConfigValueCopy on ObjectCopyWith<$R, SwampConfig, $Out>

Constants

kPageSize → const int
kRoomIdLength → const int
The length of a room ID in bytes.
kSwampProtocolPrefix → const String
Prefix used to build WebSocket subprotocol identifiers.
kSwampProtocolVersion → const int
The current Swamp protocol version.
kSwampSupportedProtocols → const List<int>
All protocol versions the library understands.

Properties

random Random
final

Functions

decodeRoomCode(String code) Uint8List
Decodes a room code string into its byte array representation.
encodeRoomCode(Uint8List data) String
Encodes a room code (byte array) into a string representation.
generateRandomRoomId() Uint8List
Generates a cryptographically secure random room ID.
parseSwampSubprotocol(String subprotocol) int?
Parses a WebSocket subprotocol string (e.g. swamp-1) and returns the protocol version number, or null if the format is invalid.
showPublicInfo(SwampServer server, HttpRequest request) → void
swampSubprotocol([int version = kSwampProtocolVersion]) String
Builds the WebSocket subprotocol string for a given version.