Skip to content

Commit

Permalink
chore: repeat websocket connection tries on android
Browse files Browse the repository at this point in the history
  • Loading branch information
siepra committed Apr 19, 2024
1 parent 13dbb74 commit 6778d4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,12 @@ class BackendWorker(private val context: Context, workerParams: WorkerParameters
*
* In any case, websocket won't connect until data server starts listening
*/
delay(WEBSOCKET_CONNECTION_DELAY)
startWebsocketConnection(dataPort, socketIOSecret)
val intervals: Array<Long> = arrayOf(WEBSOCKET_CONNECTION_DELAY, 15000, 30000, 60000, 90000)

for (interval in intervals) {
delay(interval)
startWebsocketConnection(dataPort, socketIOSecret)
}
}

val dataPath = Utils.createDirectory(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ object Const {
const val NODEJS_TRASH_DIR = "nodejs-project-trash"

// Websocket
const val WEBSOCKET_CONNECTION_DELAY: Long = 7000
const val WEBSOCKET_CONNECTION_DELAY: Long = 5000
}

0 comments on commit 6778d4e

Please sign in to comment.