From 5570902fb1ae05362fb594320bfe63638455c441 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Tue, 26 May 2020 02:51:10 +0200 Subject: Add heart beats to SW client to avoid disconnections on Heroku --- .../kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sw-client') diff --git a/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt b/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt index 5193f618..e904986a 100644 --- a/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt +++ b/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt @@ -8,6 +8,7 @@ import kotlinx.serialization.SerializationStrategy import kotlinx.serialization.builtins.list import kotlinx.serialization.builtins.serializer import org.hildan.krossbow.stomp.StompClient +import org.hildan.krossbow.stomp.config.HeartBeat import org.hildan.krossbow.stomp.conversions.kxserialization.StompSessionWithKxSerialization import org.hildan.krossbow.stomp.conversions.kxserialization.convertAndSend import org.hildan.krossbow.stomp.conversions.kxserialization.subscribe @@ -25,7 +26,9 @@ import org.luxons.sevenwonders.model.cards.PreparedCard class SevenWondersClient { - private val stompClient = StompClient() + private val stompClient = StompClient { + heartBeat = HeartBeat(10000, 15000) + } suspend fun connect(serverUrl: String): SevenWondersSession { val session = stompClient.connect("$serverUrl$SEVEN_WONDERS_WS_ENDPOINT").withJsonConversions() -- cgit