This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface MqttClient { | |
| fun connect(connectOptions: MqttConnectOptions) | |
| fun disconnect() | |
| fun reconnect() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val configuration = Courier.Configuration( | |
| client = mqttClient, | |
| streamAdapterFactories = listOf(RxJava2StreamAdapterFactory()), | |
| messageAdapterFactories = listOf(MoshiMessageAdapter.Factory()) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private val eventHandler = object : EventHandler { | |
| override fun onEvent(mqttEvent: MqttEvent) { | |
| when (mqttEvent) { | |
| is MqttConnectSuccessEvent -> { | |
| // handle MqttConnectSuccessEvent | |
| } | |
| is MqttConnectFailureEvent -> { | |
| // handle MqttConnectFailureEvent | |
| } | |
| is MqttSubscribeSuccessEvent -> { |
OlderNewer