Replies: 1 comment 2 replies
-
Still encountered this issue, I am using the following codes to serve a subscription. override suspend fun addComment(commentInput: CommentInput): Comment {
// save the comment info
flow.emit(comment)
return comment
}
val flow = MutableSharedFlow<Comment>(replay = 1)
// subscription: commentAdded
override fun commentAdded(): Flow<Comment> = flow.asSharedFlow() |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In my example project, I used a Flow to expose subscriptions endpoints.
The Flow is a
MutableSharedFlow(replay=1)
, when a mutationaddComment
is executed,flow.emit(comment)
will be called.But I followed the examples to create tests to verify the subscriptions, when the subscriptions is connected, it will be blocked and never quit.
The whole subscription tests codes is here: https://github.com/hantsy/spring-graphql-sample/blob/master/graphql-kotlin/src/test/kotlin/com/example/demo/DemoApplicationTests.kt#L87-L192
Beta Was this translation helpful? Give feedback.
All reactions