close method

Future<bool> close({
  1. CloseCode code = CloseCode.normal,
  2. String message = '',
})

Implementation

Future<bool> close({CloseCode code = CloseCode.normal, String message = ''}) {
  var bytes = BytesBuilder();
  bytes.add(code.value.bytes(bit: BitWidth.short).toList());
  bytes.add(const Utf8Encoder().convert(message).toList());
  send(OpCode.close, bytes.toBytes());
  return Future.value(true);
}