SwampConnection constructor

SwampConnection({
  1. required Uri server,
  2. int protocolVersion = kSwampProtocolVersion,
  3. Uint8List? roomId,
  4. String roomCodeEncoder(
    1. Uint8List
    ) = encodeRoomCode,
  5. Uint8List roomCodeDecoder(
    1. String
    ) = decodeRoomCode,
  6. E2EENetworkerPipe? e2eePipe,
  7. String split = kDefaultSwampSplit,
  8. 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();
}