Skip to content

Instantly share code, notes, and snippets.

View deepanshu42's full-sized avatar

Deepanshu deepanshu42

  • Gojek
  • India
View GitHub Profile
interface MqttClient {
fun connect(connectOptions: MqttConnectOptions)
fun disconnect()
fun reconnect()
}
val configuration = Courier.Configuration(
client = mqttClient,
streamAdapterFactories = listOf(RxJava2StreamAdapterFactory()),
messageAdapterFactories = listOf(MoshiMessageAdapter.Factory())
)
private val eventHandler = object : EventHandler {
override fun onEvent(mqttEvent: MqttEvent) {
when (mqttEvent) {
is MqttConnectSuccessEvent -> {
// handle MqttConnectSuccessEvent
}
is MqttConnectFailureEvent -> {
// handle MqttConnectFailureEvent
}
is MqttSubscribeSuccessEvent -> {