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
10
10
11
11
import application.presenter.EventConsumer
12
12
import application.presenter.EventParser
13
+ import com.microsoft.signalr.HubConnection
13
14
import com.microsoft.signalr.HubConnectionBuilder
15
+ import com.microsoft.signalr.HubConnectionState
14
16
import entities.events.EmptyEvent
15
17
import entities.events.Event
16
18
import infrastructure.digitaltwins.parser.DTEventParser
@@ -37,8 +39,17 @@ class SignalRClient : EventConsumer<String> {
37
39
emitter.onNext(event)
38
40
}
39
41
}, String ::class .java)
40
- connection.start ()
42
+ connection.persistentStart ()
41
43
}
42
44
43
45
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
+ }
44
55
}
You can’t perform that action at this time.
0 commit comments