VirtualWebSocketClient constructor
VirtualWebSocketClient({
- String? envId,
- String? collectionName,
- String? query,
- int? limit,
- Map<
String, String> ? orderBy, - required SendFunc send,
- required LoginFunc login,
- required IsWSConnectedFunc isWSConnected,
- required OnceWSConnectedFunc onceWSConnected,
- required GetWaitExpectedTimeoutLengthFunc getWaitExpectedTimeoutLength,
- required WatchStartCallback onWatchStart,
- required WatchCloseCallback onWatchClose,
- Function? onChange,
- Function? onError,
- bool? debug,
Implementation
VirtualWebSocketClient({
String? envId,
String? collectionName,
String? query,
int? limit,
Map<String, String>? orderBy,
required SendFunc send,
required LoginFunc login,
required IsWSConnectedFunc isWSConnected,
required OnceWSConnectedFunc onceWSConnected,
required GetWaitExpectedTimeoutLengthFunc getWaitExpectedTimeoutLength,
required WatchStartCallback onWatchStart,
required WatchCloseCallback onWatchClose,
Function? onChange,
Function? onError,
bool? debug,
}) {
this.watchId =
'watchid_${DateTime.now().millisecondsSinceEpoch}_${Random().nextDouble()}';
this._envId = envId;
this._collectionName = collectionName;
this._query = query;
this._limit = limit;
this._orderBy = orderBy;
this._send = send;
this._login = login;
this._isWSConnected = isWSConnected;
this._onceWSConnected = onceWSConnected;
this._getWaitExpectedTimeoutLength = getWaitExpectedTimeoutLength;
this._onWatchStart = onWatchStart;
this._onWatchClose = onWatchClose;
// this._debug = debug;
this._availableRetries = AvailableRetries(
initWatch: DEFAULT_MAX_AUTO_RETRY_ON_ERROR,
rebuildWatch: DEFAULT_MAX_AUTO_RETRY_ON_ERROR,
checkLast: DEFAULT_MAX_SEND_ACK_AUTO_RETRY_ON_ERROR,
);
this.listener = RealtimeListener(
close: this._closeWatch,
onChange: onChange,
onError: onError,
);
this._initWatch();
}