close method
Close the underlying connection supporting the socket.
Implementation
void close([
int? code,
String? reason,
reconnect = false,
]) {
_shouldReconnect = reconnect;
if (isConnected) {
// _ws != null and state is connected
_socketState = SocketState.closing;
_closeSink(code, reason);
} else if (!_shouldReconnect) {
dispose();
}
}