connect method
Implementation
void connect(String token, String? deviceId) async {
Log().info("CallPhoenixClient connect, deviceId = $deviceId");
var params = {"token":token};
if (deviceId != null) {
params["device_id"] = deviceId;
}
_connection = PhoenixSocket(webSocketUrl, socketOptions: PhoenixSocketOptions(params:params, heartbeatIntervalMs: 2000));
_connection?.timeout = 5000;
_connection?.reconnectAfterMs = const [1000, 2000, 2000, 2000, 2000];
_connection?.connect();
_connection?.onOpen(() => {
_notifyLogin()
});
_connection?.onClose((p0) => {
_notifyLogOut()
});
_connection?.onError((p0) => {
_notifyError(p0.toString())
});
}