https://github.com/colagom/kowet
implements STOMP protocol by websocket for KMM (WIP)
https://github.com/colagom/kowet
kotlin kotlin-multiplatform stomp websocket
Last synced: 5 months ago
JSON representation
implements STOMP protocol by websocket for KMM (WIP)
- Host: GitHub
- URL: https://github.com/colagom/kowet
- Owner: ColaGom
- Created: 2022-03-19T07:57:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-07-29T17:24:46.000Z (almost 4 years ago)
- Last Synced: 2025-02-11T14:25:15.945Z (over 1 year ago)
- Topics: kotlin, kotlin-multiplatform, stomp, websocket
- Language: Kotlin
- Homepage:
- Size: 178 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kowet
[](https://search.maven.org/search?q=g:%22io.github.colagom%22%20AND%20a:%22kowet%22)
KMM WebSocket support to STOMP protocol
# STOMP?
- https://stomp.github.io/stomp-specification-1.2.html
# Usage
### Android
```kotlin
val ws = WebSocketFactory.create("ws://10.0.2.2:8081/connect/websocket")
// create session
val session = Stomp.over(
ws,
scope = lifecycleScope
)
// subscribe topic
session.subscribe("topic", "1")
session.events.onEach {
//TODO: handle event
}.launchIn(lifecycleScope)
```
### iOS
```swift
let ws = WebSocketFactory_.shared.create(url: "ws://localhost:8081/connect/websocket")
//create session
let wrapper = SocketHelperKt.stomp(webSocket: ws)
//subscribe topic
wrapper.subscribe(destination: "topic")
wrapper.watch { event in
// handle event
}
```
# Release
### Groovy DSL
```groovy
implementation 'io.github.colagom:kowet:{version}'
```
### Kotlin DSL
```kotlin
implementation("io.github.colagom:kowet:{version}")
```