SwampConnection constructor

SwampConnection({
  1. required Uri server,
  2. Uint8List? roomId,
  3. String roomCodeEncoder(
    1. Uint8List
    ) = encodeRoomCode,
  4. Uint8List roomCodeDecoder(
    1. String
    ) = decodeRoomCode,
  5. E2EENetworkerPipe? e2eePipe,
  6. String split = kDefaultSwampSplit,
  7. RoomFlags flags = const RoomFlags(),
})

Implementation

SwampConnection({
  required super.server,
  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();
}