stop method
Implementation
@override
Future<void> stop() async {
_logger?.finest("(LongPolling transport) Stopping polling.");
// Tell receiving loop to stop, abort any current request, and then wait for it to finish
_running = false;
_pollAbort.abort();
try {
await _receiving;
// Send DELETE to clean up long polling on the server
_logger
?.finest("(LongPolling transport) sending DELETE request to $_url.");
final deleteOptions = SignalRHttpRequest();
final token = await _getAccessToken();
_updateHeaderToken(deleteOptions, token);
await _httpClient.delete(_url, options: deleteOptions);
_logger?.finest("(LongPolling transport) DELETE request sent.");
} finally {
_logger?.finest("(LongPolling transport) Stop finished.");
// Raise close event here instead of in polling
// It needs to happen after the DELETE request is sent
_raiseOnClose();
}
}