Today I tried to make a very simple GraphQL subscr...
# graphql-kotlin
n
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
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
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.