SwampConnection constructor
SwampConnection({ - required Uri server,
- int protocolVersion = kSwampProtocolVersion,
- Uint8List? roomId,
- String roomCodeEncoder(
- Uint8List
) = encodeRoomCode,
- Uint8List roomCodeDecoder(
- String
) = decodeRoomCode,
- E2EENetworkerPipe? e2eePipe,
- String split = kDefaultSwampSplit,
- RoomFlags flags = const RoomFlags(),
})
Implementation
SwampConnection({
required super.server,
super.protocolVersion,
this.roomId,
this.roomCodeEncoder = encodeRoomCode,
this.roomCodeDecoder = decodeRoomCode,
this.e2eePipe,
this.split = kDefaultSwampSplit,
this.flags = const RoomFlags(),
}) : messagePipe = SimpleNetworkerPipe() {
final channelPipe = InternalChannelPipe(bytes: 2, channel: kAnyChannel);
if (e2eePipe != null) {
registerNamedFunction(
SwampEvent.message,
).connect(channelPipe..connect(e2eePipe!..connect(messagePipe)));
} else {
registerNamedFunction(
SwampEvent.message,
).connect(channelPipe..connect(messagePipe));
}
_initFunctions();
}