connect method
- @Deprecated("Use connect with token or credential login i.e connectWithCredential(..) or connectWithToken(..)")
void
connect(
)
Implementation
@Deprecated(
"Use connect with token or credential login i.e connectWithCredential(..) or connectWithToken(..)")
void connect() {
_logger.i('connect()');
if (isConnected()) {
_logger.i('WebSocket $_storedHostAddress is already connected');
return;
}
_logger.i('connecting to WebSocket $_storedHostAddress');
try {
if (_pushMetaData != null) {
txSocket.hostAddress =
"$_storedHostAddress?voice_sdk_id=${_pushMetaData?.voice_sdk_id}";
_logger.i(
'Connecting to WebSocket with voice_sdk_id :: ${_pushMetaData?.voice_sdk_id}');
print("Connecting to WebSocket :: ${txSocket.hostAddress}");
} else {
txSocket.hostAddress = _storedHostAddress;
_logger.i('connecting to WebSocket $_storedHostAddress');
}
txSocket.onOpen = () {
_closed = false;
_connected = true;
_logger.i('Web Socket is now connected');
_onOpen();
};
txSocket.onMessage = (dynamic data) {
_onMessage(data);
};
txSocket.onClose = (int closeCode, String closeReason) {
_logger.i('Closed [$closeCode, $closeReason]!');
_connected = false;
_onClose(true, closeCode, closeReason);
};
txSocket.connect();
} catch (e, s) {
_logger.e(e.toString(), null, s);
_connected = false;
_logger.e('WebSocket $_storedHostAddress error: $e');
}
}