close method

Future<void> close([
  1. int code = 1000
])

Closes like a peer close, then waits for the handler side to reap.

Implementation

Future<void> close([int code = 1000]) async {
  _native._wsMessages.add(
    RawWsMessage(
      payload: Uint8List(0),
      connectionId: _id,
      kind: 8,
      aux: code,
    ),
  );
  await closedCode.timeout(const Duration(seconds: 5));
}