File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/main/kotlin/infrastructure/signalr Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ package infrastructure.signalr
1010
1111import application.presenter.EventConsumer
1212import application.presenter.EventParser
13+ import com.microsoft.signalr.HubConnection
1314import com.microsoft.signalr.HubConnectionBuilder
15+ import com.microsoft.signalr.HubConnectionState
1416import entities.events.EmptyEvent
1517import entities.events.Event
1618import infrastructure.digitaltwins.parser.DTEventParser
@@ -37,8 +39,17 @@ class SignalRClient : EventConsumer<String> {
3739 emitter.onNext(event)
3840 }
3941 }, String ::class .java)
40- connection.start ()
42+ connection.persistentStart ()
4143 }
4244
4345 override fun consumeEvent (inputEvent : String ): Event <Any > = eventParser.parseEvent(inputEvent)
46+
47+ private fun HubConnection.persistentStart () {
48+ this .start().blockingAwait()
49+ this .onClosed {
50+ if (this .connectionState == HubConnectionState .DISCONNECTED ) {
51+ this .persistentStart()
52+ }
53+ }
54+ }
4455}
You can’t perform that action at this time.
0 commit comments