WebSocketConnection(WebSocket socket, ClientLink clientLink, { Function onConnect, bool enableAck: false, DsCodec useCodec })

clientLink is not needed when websocket works in server link

Source

WebSocketConnection(this.socket, this.clientLink, {
  this.onConnect,
  bool enableAck: false,
  DsCodec useCodec
}) {
  if (useCodec != null) {
    codec = useCodec;
  }

  if (!enableAck) {
    nextMsgId = -1;
  }
  socket.binaryType = "arraybuffer";
  _responderChannel = new PassiveChannel(this);
  _requesterChannel = new PassiveChannel(this);
  socket.onMessage.listen(_onData, onDone: _onDone);
  socket.onClose.listen(_onDone);
  socket.onOpen.listen(_onOpen);
  // TODO, when it's used in client link, wait for the server to send {allowed} before complete this
  _onRequestReadyCompleter.complete(new Future.value(_requesterChannel));

  pingTimer = new Timer.periodic(const Duration(seconds: 20), onPingTimer);
}