Skip to content

Commit 42517c8

Browse files
committed
Use goAsync to invoke the WebSocketManager.start
1 parent 3ec4651 commit 42517c8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

app/src/main/kotlin/io/homeassistant/companion/android/websocket/WebsocketBroadcastReceiver.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ package io.homeassistant.companion.android.websocket
33
import android.content.BroadcastReceiver
44
import android.content.Context
55
import android.content.Intent
6+
import io.homeassistant.companion.android.common.util.launchAsync
67
import kotlinx.coroutines.CoroutineScope
78
import kotlinx.coroutines.Dispatchers
8-
import kotlinx.coroutines.Job
9-
import kotlinx.coroutines.launch
9+
import kotlinx.coroutines.SupervisorJob
1010

1111
class WebsocketBroadcastReceiver : BroadcastReceiver() {
12-
private val ioScope: CoroutineScope = CoroutineScope(Dispatchers.IO + Job())
12+
private val receiverScope: CoroutineScope = CoroutineScope(Dispatchers.Default + SupervisorJob())
1313

1414
override fun onReceive(context: Context, intent: Intent) {
15-
ioScope.launch {
15+
launchAsync(receiverScope) {
1616
WebsocketManager.start(context)
1717
}
1818
}

0 commit comments

Comments
 (0)