Serving a shiny app

Đang mở
#51 8 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
r
Lĩnh vực
api, backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
R
Star
119
Fork
17
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của posit-dev/plumber2

Tất cả issue của posit-dev/plumber2

Issue tương tự

Thêm issue về R

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.