baseRunPolling method
Base longPoll loop
Implementation
Stream<dynamic> baseRunPolling() async* {
await _setup();
while (_isOn) {
await Future.delayed(Duration(milliseconds: 150));
try {
var _response = await _getNewRequest();
var response = _parseJsonBody(_response);
if (_response.headers.containsKey('x-next-ts')) {
_requests_query_params.update(
'ts', (value) => _response.headers['x-next-ts']!);
} else {
await _resolveFailed(response);
continue;
}
if (response['updates'] == null) {
continue;
}
for (var update in response['updates']) {
yield update;
}
} catch (err) {
print('Please put this in issue');
closeSession();
rethrow;
}
}
}