SwampServer class

The main Swamp server class.

This class handles client connections, manages rooms, and processes RPC commands. It extends NetworkerSocketServer to provide TCP/socket server functionality.

Inheritance
  • Object
  • NetworkerSocketServer
  • SwampServer

Constructors

SwampServer(dynamic serverAddress, int port, {ConfigManager? configManager, bool withConsole = true, LogLevel? minLogLevel, SecurityContext? securityContext})
Creates a new SwampServer.

Properties

address Uri
no setterinherited
clientChange Stream<Set<Channel>>
no setterinherited
clientConnect Stream<(Channel, ConnectionInfo)>
no setterinherited
clientConnections Set<Channel>
no setterinherited
clientDisconnect Stream<(Channel, ConnectionInfo)>
no setterinherited
config SwampConfig
The current server configuration.
no setter
configManager ConfigManager
The configuration manager for the server.
final
filterConnections FutureOr<bool> Function(HttpRequest event)?
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
isClosed bool
no setterinherited
isOpen bool
no setterinherited
onClosed Stream<void>
no setterinherited
onOpen Stream<void>
no setterinherited
overrideStatusCode bool
finalinherited
port int
finalinherited
read Stream<NetworkerPacket<Uint8List>>
no setterinherited
roomManager SwampRoomManager
The room manager responsible for handling room logic.
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
securityContext SecurityContext?
finalinherited
server HttpServer?
no setterinherited
serverAddress → dynamic
finalinherited
write Stream<NetworkerPacket<Uint8List>>
no setterinherited

Methods

addClientConnection(NetworkerSocketInfo info, [Channel? id]) → Channel
inherited
clearConnections() → void
inherited
close() Future<void>
override
closeConnection(Channel id) → void
inherited
connect(NetworkerPipe<Uint8List, dynamic> pipe) → void
inherited
decode(Uint8List data) Uint8List
inherited
decodeChannel(Uint8List data, Channel channel) FutureOr<(Uint8List, Channel)?>
inherited
disconnect(NetworkerPipe<Uint8List, dynamic> pipe) → void
inherited
dispose() → void
Disposes all stream controllers and disconnects all connected pipes.
inherited
encode(Uint8List data) Uint8List
inherited
encodeChannel(Uint8List data, Channel channel) FutureOr<(Uint8List, Channel)?>
inherited
getConnectionInfo(Channel channel) → NetworkerSocketInfo?
inherited
handleData(Uint8List data, Channel channel) → void
Processes incoming data from a client.
inherited
handleRequest(HttpRequest request) Future<void>
Handles an incoming HttpRequest.
override
handleWebSocketConnection(Channel id, NetworkerSocketInfo info, WebSocket socket) → void
Sets up listeners for a WebSocket connection.
inherited
handleWebSocketUpgrade(HttpRequest request) Future<void>
Upgrades an HttpRequest to a WebSocket connection and registers it.
override
init() Future<void>
inherited
log(Object? message, [LogLevel? level]) → void
Logs a message to the console.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onClientConnected(Channel id, NetworkerSocketInfo info) → void
Called when a new client connection is added. Override this to perform custom logic on connection.
inherited
onClientDisconnected(Channel id, NetworkerSocketInfo info) → void
Called when a client disconnects. Override this to perform custom logic on disconnection.
inherited
onMessage(Uint8List data, [Channel channel = kAnyChannel]) Future<void>
inherited
removeConnection(Channel id) bool
inherited
sendMessage(Uint8List data, [Channel channel = kAnyChannel]) Future<void>
inherited
sendPacket(Uint8List data, Channel channel) FutureOr<void>
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited