Skip to content

Commit 0cffb99

Browse files
douglasmuraokaphillwiggins
authored andcommitted
fix(LiveQuery): Session token null when subscribing (parse-community#228)
When `autoSendSessionId: true`, it always sets the sessionToken header, even if `null`. However, when `null`, it throws an exception due to its unexpected type and breaks live query. ``` I/flutter (12537): LiveQuery: : ConnectMessage: {op: connect, applicationId: myAppId, masterKey: 123456, sessionToken: null} I/flutter (12537): LiveQuery: : SubscribeMessage: {op: subscribe, requestId: 1, query: {className: Diet_Plans, where: {objectId: 2pNUgv1CKA}}, sessionToken: null} I/flutter (12537): LiveQuery: : Listen: {"op":"error","error":"Invalid type: null (expected string)","code":1,"reconnect":true} ```
1 parent beb98fe commit 0cffb99

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: lib/src/network/parse_live_query.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class LiveQuery {
117117
'op': 'connect',
118118
'applicationId': _client.data.applicationId
119119
};
120-
if (_sendSessionId) {
120+
if (_sendSessionId && _client.data.sessionId != null) {
121121
_connectMessage['sessionToken'] = _client.data.sessionId;
122122
}
123123

@@ -143,7 +143,7 @@ class LiveQuery {
143143
'fields': keysToReturn
144144
}
145145
};
146-
if (_sendSessionId) {
146+
if (_sendSessionId && _client.data.sessionId != null) {
147147
_subscribeMessage['sessionToken'] = _client.data.sessionId;
148148
}
149149

0 commit comments

Comments
 (0)