close method

void close([
  1. dynamic discard = false
])

Closes the socket and underlying transport.

Implementation

void close([discard = false]) {
  if ('open' != readyState) return;
  readyState = 'closing';

  if (writeBuffer.isNotEmpty) {
    once('drain', (_) => closeTransport(discard));
    return;
  }

  closeTransport(discard);
}