@@ -31,7 +31,7 @@ class Subscription<T extends ParseObject> {
31
31
}
32
32
}
33
33
34
- enum LiveQueryClientEvent { CONNECTED , DISCONNECTED , USER_DISCONNECTED }
34
+ enum LiveQueryClientEvent { connected, disconnected, userDisconnected }
35
35
36
36
class LiveQueryReconnectingController {
37
37
LiveQueryReconnectingController (
@@ -50,16 +50,16 @@ class LiveQueryReconnectingController {
50
50
}
51
51
_eventStream.listen ((LiveQueryClientEvent event) {
52
52
switch (event) {
53
- case LiveQueryClientEvent .CONNECTED :
53
+ case LiveQueryClientEvent .connected :
54
54
_isConnected = true ;
55
55
_retryState = 0 ;
56
56
_userDisconnected = false ;
57
57
break ;
58
- case LiveQueryClientEvent .DISCONNECTED :
58
+ case LiveQueryClientEvent .disconnected :
59
59
_isConnected = false ;
60
60
_setReconnect ();
61
61
break ;
62
- case LiveQueryClientEvent .USER_DISCONNECTED :
62
+ case LiveQueryClientEvent .userDisconnected :
63
63
_userDisconnected = true ;
64
64
Timer ? currentTimer = _currentTimer;
65
65
if (currentTimer != null ) {
@@ -70,14 +70,14 @@ class LiveQueryReconnectingController {
70
70
}
71
71
72
72
if (debug) {
73
- print ('$DEBUG_TAG : $event ' );
73
+ print ('$debugTag : $event ' );
74
74
}
75
75
});
76
76
ParseCoreData ().appResumedStream? .listen ((void _) => _setReconnect ());
77
77
}
78
78
79
79
static List <int > get retryInterval => ParseCoreData ().liveListRetryIntervals;
80
- static const String DEBUG_TAG = 'LiveQueryReconnectingController' ;
80
+ static const String debugTag = 'LiveQueryReconnectingController' ;
81
81
82
82
final Function _reconnect;
83
83
final Stream <LiveQueryClientEvent > _eventStream;
@@ -99,7 +99,7 @@ class LiveQueryReconnectingController {
99
99
_isConnected = false ;
100
100
}
101
101
if (debug) {
102
- print ('$DEBUG_TAG : $state ' );
102
+ print ('$debugTag : $state ' );
103
103
}
104
104
_setReconnect ();
105
105
}
@@ -116,7 +116,7 @@ class LiveQueryReconnectingController {
116
116
_reconnect ();
117
117
});
118
118
if (debug) {
119
- print ('$DEBUG_TAG : Retrytimer set to ${retryInterval [_retryState ]}ms' );
119
+ print ('$debugTag : Retry timer set to ${retryInterval [_retryState ]}ms' );
120
120
}
121
121
if (_retryState < retryInterval.length - 1 ) {
122
122
_retryState++ ;
@@ -188,13 +188,13 @@ class LiveQueryClient {
188
188
if (webSocket != null ) {
189
189
return webSocket.readyState;
190
190
}
191
- return parse_web_socket.WebSocket .CONNECTING ;
191
+ return parse_web_socket.WebSocket .connecting ;
192
192
}
193
193
194
194
Future <dynamic > disconnect ({bool userInitialized = false }) async {
195
195
parse_web_socket.WebSocket ? webSocket = _webSocket;
196
196
if (webSocket != null &&
197
- webSocket.readyState == parse_web_socket.WebSocket .OPEN ) {
197
+ webSocket.readyState == parse_web_socket.WebSocket .open ) {
198
198
if (_debug) {
199
199
print ('$_printConstLiveQuery : Socket closed' );
200
200
}
@@ -215,7 +215,7 @@ class LiveQueryClient {
215
215
_connecting = false ;
216
216
if (userInitialized) {
217
217
_clientEventStreamController.sink
218
- .add (LiveQueryClientEvent .USER_DISCONNECTED );
218
+ .add (LiveQueryClientEvent .userDisconnected );
219
219
}
220
220
}
221
221
@@ -224,7 +224,7 @@ class LiveQueryClient {
224
224
{T ? copyObject}) async {
225
225
if (_webSocket == null ) {
226
226
await _clientEventStream.any ((LiveQueryClientEvent event) =>
227
- event == LiveQueryClientEvent .CONNECTED );
227
+ event == LiveQueryClientEvent .connected );
228
228
}
229
229
final int requestId = _requestIdGenerator ();
230
230
final Subscription <T > subscription =
@@ -272,7 +272,7 @@ class LiveQueryClient {
272
272
await parse_web_socket.WebSocket .connect (_liveQueryURL);
273
273
_webSocket = webSocket;
274
274
_connecting = false ;
275
- if (webSocket.readyState == parse_web_socket.WebSocket .OPEN ) {
275
+ if (webSocket.readyState == parse_web_socket.WebSocket .open ) {
276
276
if (_debug) {
277
277
print ('$_printConstLiveQuery : Socket opened' );
278
278
}
@@ -288,13 +288,13 @@ class LiveQueryClient {
288
288
_handleMessage (message);
289
289
}, onDone: () {
290
290
_clientEventStreamController.sink
291
- .add (LiveQueryClientEvent .DISCONNECTED );
291
+ .add (LiveQueryClientEvent .disconnected );
292
292
if (_debug) {
293
293
print ('$_printConstLiveQuery : Done' );
294
294
}
295
295
}, onError: (Object error) {
296
296
_clientEventStreamController.sink
297
- .add (LiveQueryClientEvent .DISCONNECTED );
297
+ .add (LiveQueryClientEvent .disconnected );
298
298
if (_debug) {
299
299
print (
300
300
'$_printConstLiveQuery : Error: ${error .runtimeType .toString ()}' );
@@ -307,7 +307,7 @@ class LiveQueryClient {
307
307
});
308
308
} on Exception catch (e) {
309
309
_connecting = false ;
310
- _clientEventStreamController.sink.add (LiveQueryClientEvent .DISCONNECTED );
310
+ _clientEventStreamController.sink.add (LiveQueryClientEvent .disconnected );
311
311
if (_debug) {
312
312
print ('$_printConstLiveQuery : Error: ${e .toString ()}' );
313
313
}
@@ -390,12 +390,12 @@ class LiveQueryClient {
390
390
391
391
Subscription ? subscription;
392
392
if (actionData.containsKey ('op' ) && actionData['op' ] == 'connected' ) {
393
- print ('ReSubScription :$_requestSubscription ' );
393
+ print ('Re subscription :$_requestSubscription ' );
394
394
395
- _requestSubscription.values.toList ().forEach ((Subscription subcription ) {
396
- _subscribeLiveQuery (subcription );
395
+ _requestSubscription.values.toList ().forEach ((Subscription subscription ) {
396
+ _subscribeLiveQuery (subscription );
397
397
});
398
- _clientEventStreamController.sink.add (LiveQueryClientEvent .CONNECTED );
398
+ _clientEventStreamController.sink.add (LiveQueryClientEvent .connected );
399
399
return ;
400
400
}
401
401
if (actionData.containsKey ('requestId' )) {
0 commit comments