getInitialHandshake static method

List<int> getInitialHandshake(
  1. int messageLengthExponent,
  2. int serializerType
)

Sends a handshake of the morphology 0111 1111 LLLL SSSS RRRR RRRR RRRR RRRR LLLL = 2^(9+0bLLLL), the accepted message length SSSS = 0b0001 = JSON, 0b0010 = MsgPack RRRR are reserved bytes

Implementation

static List<int> getInitialHandshake(
    int messageLengthExponent, int serializerType) {
  var initialHandShake = Uint8List(4);
  initialHandShake[0] = SocketHelper._metaHeader;
  initialHandShake[1] =
      ((max(0, min(15, messageLengthExponent - 9)) << 4) | serializerType);
  initialHandShake[2] = 0;
  initialHandShake[3] = 0;
  return initialHandShake.toList(growable: false);
}