SwampConnection class

Inheritance

Constructors

SwampConnection({required Uri server, int protocolVersion = kSwampProtocolVersion, String? accessToken, Uint8List? roomId, String roomCodeEncoder(Uint8List) = encodeRoomCode, Uint8List roomCodeDecoder(String) = decodeRoomCode, E2EENetworkerPipe? e2eePipe, String split = kDefaultSwampSplit, RoomFlags flags = const RoomFlags()})
SwampConnection.build(Uri address, {String split = kDefaultSwampSplit, String roomCodeEncoder(Uint8List)?, Uint8List roomCodeDecoder(String)?, RoomFlags flags = const RoomFlags(), int protocolVersion = kSwampProtocolVersion, String? accessToken})
factory

Properties

accessToken → String?
Bearer token sent as the first Swamp protocol command.
finalinherited
address → Uri
no setteroverride
clientChange → Stream<Set<Channel>>
no setterinherited
clientConnect → Stream<(Channel, ConnectionInfo)>
no setterinherited
clientConnections → Set<Channel>
no setterinherited
clientDisconnect → Stream<(Channel, ConnectionInfo)>
no setterinherited
config → RpcConfig
no setterinherited
defaultReceiverChannel → Channel
no setterinherited
e2eePipe → E2EENetworkerPipe?
final
flags → RoomFlags
final
hashCode → Channel
The hash code for this object.
no setterinherited
isClosed → bool
no setterinherited
isOpen → bool
no setterinherited
isServer → bool
no setteroverride
kickMessage → Uint8List?
no setter
kickReason → KickReason?
no setter
messagePipe → RawNetworkerPipe
final
onClosed → Stream<void>
no setterinherited
onCreationFailed → Stream<CreationFailedReason>
no setter
onJoinFailed → Stream<JoinFailedReason>
no setter
onKicked → Stream<KickReason>
no setter
onOpen → Stream<void>
no setterinherited
onRoomInfo → Stream<RoomInfo>
no setter
onWelcome → Stream<void>
no setter
protocolVersion → Channel
The protocol version this client will use when connecting.
finalinherited
read → Stream<NetworkerPacket<RpcNetworkerPacket>>
no setterinherited
receiverChannel → Channel?
no setterinherited
roomCodeDecoder → Uint8List Function(String)
final
roomCodeEncoder → String Function(Uint8List)
final
roomId → Uint8List?
final
roomInfo → RoomInfo?
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
server → Uri
finalinherited
split → String
final
write → Stream<NetworkerPacket<Uint8List>>
no setterinherited

Methods

addClientConnection(SwampClientConnectionInfo info, [Channel? id]) → Channel
inherited
callFunction(int function, Uint8List data, {Channel sender = kAnyChannel, bool forceLocal = false}) → bool
inherited
callNamedFunction(SwampEvent name, Uint8List data, {Channel sender = kAnyChannel, bool forceLocal = false}) → bool
inherited
clearConnections() → Future<void>
inherited
close() → Future<void>
override
closeConnection(Channel id) → Future<bool>
inherited
connect(NetworkerPipe<RpcNetworkerPacket, dynamic> pipe) → void
inherited
decode(Uint8List data) → RpcNetworkerPacket
inherited
decodeChannel(Uint8List data, Channel channel) → FutureOr<(RpcNetworkerPacket, Channel)?>
inherited
disconnect(NetworkerPipe<RpcNetworkerPacket, dynamic> pipe) → void
inherited
dispose() → void
Disposes all stream controllers and disconnects all connected pipes.
inherited
encode(RpcNetworkerPacket data) → Uint8List
inherited
encodeChannel(RpcNetworkerPacket data, Channel channel) → FutureOr<(Uint8List, Channel)?>
inherited
getConnectionInfo(Channel channel) → SwampClientConnectionInfo?
inherited
getFunction(int function) → RawNetworkerPipe?
inherited
getNamedFunction(SwampEvent name) → RawNetworkerPipe?
inherited
getSecureAddress() → Future<Uri>
init() → Future<void>
override
isValidCall(int function, Channel sender, [Channel receiver = kAnyChannel]) → bool
inherited
isValidNamedCall(SwampEvent name, Channel sender, [Channel receiver = kAnyChannel]) → bool
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onClientConnected(Channel id, SwampClientConnectionInfo info) → void
Called when a new client connection is added. Override this to perform custom logic on connection.
inherited
onClientDisconnected(Channel id, SwampClientConnectionInfo 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
registerFunction(int function, {bool canRunLocally = false, RpcNetworkerMode mode = RpcNetworkerMode.authority}) → RawNetworkerPipe
inherited
registerNamedFunction(SwampEvent name) → RawNetworkerPipe
inherited
registerNamedFunctions(List<SwampEvent> functions) → List<RawNetworkerPipe>
inherited
removeConnection(Channel id) → Future<bool>
inherited
runFunction(RpcNetworkerPacket packet, {bool forceLocal = false, Channel? channel}) → bool
inherited
runNamedFunction(RpcNetworkerPacket packet, {bool forceLocal = false, Channel? channel}) → bool
inherited
sendFunction(int function, Uint8List data, {Channel channel = kAnyChannel, Channel? receiver, bool forceLocal = false}) → void
inherited
sendMessage(RpcNetworkerPacket data, [Channel channel = kAnyChannel]) → Future<void>
inherited
sendNamedFunction(SwampCommand name, Uint8List data, {Channel channel = kAnyChannel, bool forceLocal = false, Channel? receiver}) → void
inherited
sendPacket(Uint8List data, Channel channel) → void
inherited
toString() → String
A string representation of this object.
inherited
unregisterFunction(int function) → bool
inherited
unregisterNamedFunction(SwampEvent name) → bool
inherited

Operators

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

Static Methods

buildSecure(Uri address, Cipher cipher, {String roomCodeEncoder(Uint8List) = encodeRoomCode, Uint8List roomCodeDecoder(String) = decodeRoomCode, String split = kDefaultSwampSplit, RoomFlags flags = const RoomFlags(), int protocolVersion = kSwampProtocolVersion, String? accessToken}) → Future<SwampConnection>