question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

native subscription support for Kotlin Flow

See original GitHub issue

Is your feature request related to a problem? Please describe. As per graphql-java currently we only support subscription functions that return some Publisher (e.g. Reactor Flux). Since we support coroutines for queries/mutations we should also support Flow for subscriptions.

Describe the solution you’d like Support Kotlin Flow type for subscriptions.

Describe alternatives you’ve considered N/A

Additional context N/A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
josephlbarnettcommented, Oct 10, 2019

Would it make sense to have graphql-kotllin provide a class that extends SubscriptionExecutionStrategy to treat Flows similar to how it currently treats Publishers? I think doing so to only support Flows would be somewhat straightforward port of the class, but probably want to be able to support either Flow or Publisher from the same strategy, which may be a little less straighforward to figure out?

0reactions
josephlbarnettcommented, Feb 28, 2020

note that due to issues like https://github.com/Kotlin/kotlinx.coroutines/issues/1825 doing flow.asPublisher() in the schema function and then consuming the ExecutionResult’s publisher .asFlow() can have unexpected side effects

Read more comments on GitHub >

github_iconTop Results From Across the Web

Subscriptions in Apollo Kotlin - Apollo GraphQL Docs
Subscriptions are long-lived GraphQL read operations that can update their response over time, enabling clients to receive updates as they occur. They're ...
Read more >
Asynchronous Flow - Kotlin
Terminal operators on flows are suspending functions that start a collection of the flow. The collect operator is the most basic one, but...
Read more >
Smarter Shared Kotlin Flows - Christophe Beyls - Medium
A technique that can be used to make SharedFlows integrate better with the Lifecycle when used in ViewModels of Android applications, allowing to...
Read more >
Flow.Subscription - Android Developers
Causes the Subscriber to (eventually) stop receiving messages. ... A cancelled subscription need not ever receive an onComplete or onError signal.
Read more >
kotlinx.coroutines 1.4.0: Introducing StateFlow and SharedFlow
The Flow API in Kotlin is designed to asynchronously handle a stream of data that executes sequentially. In essence, Flow is a sequence....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found