Asynchronous API endpoints in plumber

How do I define asynchronous API endpoints in plumber ?

I didn't really find plumber-specific documentation on the topic except this example and this GitHub issue

When I try to reproduce the example, I get an error that R doesn't know how to turn a promise into JSON (at least that's what I think the problem is):

<simpleError: No method asJSON S3 class: promise>

What am I doing wrong? Is there any official doc on this?

Disclaimer

I'm new to future and promises and only made it mid-way through the docs on https://rstudio.github.io/promises/ yet.


Referred here by plumber's GitHub

@Rappster welcome to RStudio Community!

The asynchronous features of Plumber are currently only available in the GitHub version of the package and are not yet available through CRAN. The example you referenced should work as long as you have downloaded the package from GitHub instead of CRAN. This can be done using the remotes package as follows: remotes::install_github("rstudio/plumber").

Unfortunately, there isn't any existing documentation for async features in Plumber. This is something on the roadmap and we hope to provide updated documentation in the near future.

1 Like

@Blair09M Thanks for getting back to me on this. I will try the code with the GitHub version of the package and am looking forward to further documentation on asynchronous features of/in plumber