disconnect method
void
disconnect()
Implementation
void disconnect() {
logger.debug('close()');
_close_requested = true;
_recover_attempts = 0;
status = C.STATUS_DISCONNECTED;
// Clear recovery_timer.
if (_recovery_timer != null) {
clearTimeout(_recovery_timer);
_recovery_timer = null;
}
// Unbind socket event callbacks.
socket!.onconnect = () => () {};
socket!.ondisconnect = (WebSocketInterface socket, bool error,
int? closeCode, String? reason) =>
() {};
socket!.ondata = (dynamic data) => () {};
socket!.disconnect();
ondisconnect(
socket,
ErrorCause(
cause: 'disconnect',
status_code: 0,
reason_phrase: 'close by local'));
}