void close()

close the connection

Source

void close() {
  if (socket.readyState == WebSocket.OPEN ||
      socket.readyState == WebSocket.CONNECTING) {
    socket.close();
  }
  _onDone();
}