Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support RxJS #44

Closed
quen2404 opened this issue Aug 16, 2018 · 3 comments
Closed

Support RxJS #44

quen2404 opened this issue Aug 16, 2018 · 3 comments

Comments

@quen2404
Copy link

It is possible to provide RXJS support for resolver functions (@Query(), @Mutation(), @ResolveProperty(), ...) ? Like nest route handler, they could return RXJS observable streams :

@Query()
findAll(): Observable<any[]> {
  return of([]);
}
@cschroeter
Copy link

How should this work? An observable emits values over time, so its more like a subscription.
Here is what I did in another project

const pubsub = new PubSub();

interval(5000)
  .pipe(
    switchMap(() => fetch('http://localhost:61208/api/2/quicklook').then(res => res.json())),
    retryWhen(errors =>
      errors.pipe(
        tap(error => console.error(error.message)),
        delay(3000)
      )
    )
  )
  .subscribe(val => pubsub.publish('Monitoring', { Monitoring: { node: val } }));

@kamilmysliwiec
Copy link
Member

Duplicate of #41

@kamilmysliwiec kamilmysliwiec marked this as a duplicate of #41 Aug 31, 2018
@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants