Serving a shiny app

Aperta
#51 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
r
Ambito
api, backend

Direzione di ricerca

Reproduce the report using plumber.R, the shiny/app.R example, and the api_shiny() help example, then run the shown plumber2 API command. Inspect how the @shiny route handles the app's websocket connection and plot output. Done means either interactive rendering works at /my_app/ without the reported websocket error, or the supported behavior and limitation are clearly documented.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Thanks a lot for this great R package! I am new to plumber(2) and am experimenting with serving a shiny app.
I copied the app.R example app into a shiny subdirectory and defined the following plumber.R file:

#* @shiny /my_app/
shiny::shinyAppDir("./shiny")

When I start the API with

library(plumber2)

pa <- plumber2::api("plumber.R")
pa |> plumber2::api_run(showcase = FALSE)

I get the following message, confirming that the server is running:

plumber2 server started at http://127.0.0.1:8080

When I navigate to http://127.0.0.1:8080/my_app/ in chrome, I see the title and the interactive slider of the app, but no plot. When I reload the page in the browser, I get the following error in the R console:

Error in websocket callback: A payload contained invalid data
Error executing onWSMessage (1011)

I might be misunderstanding how shiny apps are intended to be used with plumber2. Perhaps you can point me in the right direction? The minimal example on the help page for api_shiny() was helpful, but I am not sure if I should expect a fully interactive plot?

Many thanks for any pointers!

Session Information

R version 4.5.1 (2025-06-13)
Platform: aarch64-apple-darwin20
Running under: macOS Sequoia 15.6.1

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Los_Angeles
tzcode source: internal

attached base packages:
[1] stats graphics grDevices datasets utils methods base

other attached packages:
[1] shiny_1.11.1 plumber2_0.1.0

loaded via a namespace (and not attached):
[1] xfun_0.53 bslib_0.9.0 processx_3.8.6 websocket_1.4.4 firestorm_0.1.0
[6] callr_3.7.6 ps_1.9.1 vctrs_0.6.5 tools_4.5.1 curl_7.0.0
[11] parallel_4.5.1 tibble_3.3.0 pkgconfig_2.0.3 mirai_2.5.0 lifecycle_1.0.4
[16] compiler_4.5.1 stringr_1.5.2 textshaping_1.0.3 brio_1.1.5 codetools_0.2-20
[21] brotli_1.3.2 sodium_1.4.0 httpuv_1.6.16 routr_1.0.0 htmltools_0.5.8.1
[26] sass_0.4.10 later_1.4.4 pillar_1.11.1 jquerylib_0.1.4 cachem_1.1.0
[31] mime_0.13 parallelly_1.45.1 digest_0.6.37 stringi_1.8.7 future_1.67.0
[36] purrr_1.1.0 listenv_0.9.1 fastmap_1.2.0 cli_3.6.5 magrittr_2.0.4
[41] base64enc_0.1-3 triebeard_0.4.1 withr_3.0.2 promises_1.3.3 roxygen2_7.3.3
[46] globals_0.18.0 ragg_1.5.0 reqres_1.0.0 webutils_1.2.2 memoise_2.0.1
[51] evaluate_1.0.5 knitr_1.50 rlang_1.1.6 urltools_1.7.3.1 Rcpp_1.1.0
[56] nanonext_1.7.0 xtable_1.8-4 glue_1.8.0 xml2_1.4.0 renv_1.1.5
[61] svglite_2.2.1 fiery_1.3.0 firesafety_0.1.0 jsonlite_2.0.0 R6_2.6.1
[66] systemfonts_1.2.3 fs_1.6.6 rapidoc_9.3.4

Lingua principale
R
Stelle
119
Fork
17
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di posit-dev/plumber2

Tutte le issue di posit-dev/plumber2

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.