lateinit var stompConnection: Disposable
lateinit var topic: Disposable
val url = "ws://example.com/endpoint"
val intervalMillis = 1000L
val client = OkHttpClient()
val stomp = StompClient(url, intervalMillis, client)
// connect
stompConnection = stomp.connect().subscribe {
when (it.type) {
Event.Type.OPENED -> {
}
Event.Type.CLOSED -> {
}
Event.Type.ERROR -> {
}
}
}
// subscribe
topic = stomp.subscribe("/destination").subscribe { Log.i(TAG, it) }
// unsubscribe
topic.dispose()
// send
stomp.send("/destination", "dummy message").subscribe {
if (it) {
}
}
// disconnect
stompConnection.dispose()
forked from bishoybasily/stomp
-
Notifications
You must be signed in to change notification settings - Fork 0
Thomas-Kuipers/stomp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Stomp client for kotlin
Resources
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Kotlin 90.0%
- Java 10.0%