This repository was archived by the owner on Jun 13, 2023. It is now read-only.
File tree 1 file changed +26
-2
lines changed
Sources/ParseLiveQuery/Internal
1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -140,8 +140,32 @@ extension Client: WebSocketDelegate {
140
140
if shouldPrintWebSocketLog { NSLog ( " ParseLiveQuery: Received binary data but we don't handle it... " ) }
141
141
case . error( let error) :
142
142
NSLog ( " ParseLiveQuery: Error processing message: \( String ( describing: error) ) " )
143
- default :
144
- break
143
+ case . viabilityChanged( let isViable) :
144
+ if shouldPrintWebSocketLog { NSLog ( " ParseLiveQuery: WebSocket viability channged to \( isViable ? " " : " not- " ) viable " ) }
145
+ if !isViable {
146
+ isConnecting = false
147
+ }
148
+ // TODO: Better retry logic, unless `disconnect()` was explicitly called
149
+ if !userDisconnected, isViable {
150
+ reconnect ( )
151
+ }
152
+ case . reconnectSuggested( let isSuggested) :
153
+ if shouldPrintWebSocketLog { NSLog ( " ParseLiveQuery: WebSocket reconnect is \( isSuggested ? " " : " not " ) suggested " ) }
154
+ // TODO: Better retry logic, unless `disconnect()` was explicitly called
155
+ if !userDisconnected, isSuggested {
156
+ reconnect ( )
157
+ }
158
+ case . cancelled:
159
+ isConnecting = false
160
+ if shouldPrintWebSocketLog { NSLog ( " ParseLiveQuery: WebSocket connection cancelled... " ) }
161
+ // TODO: Better retry logic, unless `disconnect()` was explicitly called
162
+ if !userDisconnected {
163
+ reconnect ( )
164
+ }
165
+ case . pong( _) :
166
+ if shouldPrintWebSocketLog { NSLog ( " ParseLiveQuery: Received pong but we don't handle it... " ) }
167
+ case . ping( _) :
168
+ if shouldPrintWebSocketLog { NSLog ( " ParseLiveQuery: Received ping but we don't handle it... " ) }
145
169
}
146
170
}
147
171
}
You can’t perform that action at this time.
0 commit comments