Close eventSource

This commit is contained in:
sim 2023-03-05 15:51:23 +01:00
parent 5d64a9b27d
commit 2f92edc511
1 changed files with 2 additions and 0 deletions

View File

@ -65,6 +65,7 @@ class SSEListener(val context: Context) : EventSourceListener() {
} }
override fun onClosed(eventSource: EventSource) { override fun onClosed(eventSource: EventSource) {
eventSource.cancel()
if (!StartService.isServiceStarted) { if (!StartService.isServiceStarted) {
return return
} }
@ -74,6 +75,7 @@ class SSEListener(val context: Context) : EventSourceListener() {
} }
override fun onFailure(eventSource: EventSource, t: Throwable?, response: Response?) { override fun onFailure(eventSource: EventSource, t: Throwable?, response: Response?) {
eventSource.cancel()
if (!StartService.isServiceStarted) { if (!StartService.isServiceStarted) {
return return
} }