joffrey-bion / krossbow

A Kotlin multiplatform coroutine-based STOMP client over websockets, with built-in conversions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide a sample project to demonstrate a runnable full stack Krossbow example

joffrey-bion opened this issue · comments

For beginners, the getting started guide might not be sufficient to see how all the pieces come together. It would be useful to provide a sample project that they can explore and play with.

In the meantime, the Seven Wonders game project, which uses Krossbow for its client, is the only real example we can show, but for a beginner it is likely overwhelming.

See initial discussion in #479

commented

I'm learning (or at least trying :D) copying snippets from the Seven Wonders client but for example I got an error on this line taken from https://github.com/joffrey-bion/seven-wonders/blob/main/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt#L47:

suspend fun watchErrors(): Flow<ErrorDTO> = stompSession.subscribe("/user/queue/errors", ErrorDTO.serializer())

The compiler tells me:

exception: src/main/kotlin/Main.kt:55:72: error: type mismatch: inferred type is String but StompSubscribeHeaders was expected
exception: suspend fun watchErrors(): Flow = stompSession.subscribe("/user/queue/errors", ErrorDTO.serializer())
exception: ^

Any hints?

commented

Found the problem, my bad: the "subscribe" function is overloaded and hence must be imported.
The problem is fixed adding this import:

import org.hildan.krossbow.stomp.conversions.kxserialization.subscribe

Sorry for the noise!

No problem for the noise, I'm happy you found your answer :)