https://kotlinlang.org logo
#graphql-kotlin
Title
# graphql-kotlin
n

Neal Sanche

05/04/2021, 11:18 PM
Today I tried to make a very simple GraphQL subscription and hit some dead ends. Details in thread.
On the graphql-kotlin server side I wrote this silly subscription.
This is being consumed by Apollo GraphQL on Kotlin Multiplatform. But, what I see over on that side is that usually all I get is the first string, "hi" or the first and last string, but rarely do I get all of them. I'd be willing to concede that this might be an issue on the client side, but thought I'd ask here first if anyone has had these sorts of issues?
s

Shane Myrick

05/05/2021, 12:07 AM
Adding this function to the example spring app and calling it from the GraphQL Playground returns the correct data, so it sounds like a client issue
Copy code
fun flowBuilder(): Publisher<String> = kotlinx.coroutines.flow.flow {
        emit("hi")
        delay(1000)
        emit("there")
        delay(1000)
        emit("world")
    }.asPublisher()
Make sure your client is implementing the
graphql-ws
protocol https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md
n

Neal Sanche

05/05/2021, 2:35 PM
Thanks, yes, I do think there's some sort of mismatch going on with this. And I will focus on the client side and see if I can verify which protocol is being used.
It does use graphql-ws. So I'll keep looking for why this isn't working.
40 Views