-
Notifications
You must be signed in to change notification settings - Fork 78
Proxy WebSocket communication through the main thread #562
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
Conversation
Could you add the ca-bundle path explicitly to the
|
Has https://webr.r-wasm.org/proxy-websockets/ been updated yet to this latest PR? We still need to set Sys.setenv(ALL_PROXY='socks5h://test:[email protected]:443')
install.packages('curl')
library(curl)
# Show that proxy works
curl_fetch_memory('http://hb.opencpu.org/get', handle = new_handle(verbose=TRUE))
# Run more complex examples
example(multi_run)
example(curl) Perhaps we just need to rebuild libcurl and/or the curl R package with this new |
Not yet, I trigger PR deployments manually. The I'll add the ca-bundle path config to curl and deploy a new build once I'm back next week :) |
Here is an example pushing this to download 200 files in parallel over HTTP2 This works on https://webr.r-wasm.org/proxy-websockets/ install.packages('curl')
Sys.setenv(ALL_PROXY='socks5h://test:[email protected]:443')
mirror <- 'https://cran.rstudio.com'
df <- read.dcf(curl::curl(sprintf('%s/src/contrib/PACKAGES', mirror)))
pkgs <- df[1:200,'Package']
urls <- sprintf('%s/web/packages/%s/DESCRIPTION', mirror, pkgs)
outdir <- file.path(tempdir(), 'descriptions')
files <- sprintf('%s/%s.txt', outdir, pkgs)
dir.create(outdir, showWarnings = FALSE)
results <- curl::multi_download(urls, files, progress = FALSE, multiplex = T, verbose=T)
all(results$status == 200)
list.files(outdir) |
It seems the path to the CA bundle is different at build time than in the r-wasm runtime. I get an error in the WebR:
So I think we need to configure the runtime path location the CA bundle in curl:
Or alternatively the runtime needs a symlink |
OK, let’s try with |
Thanks, all looks good now from my end. I think this is ready for public preview. |
Co-authored-by: Jeroen Ooms <[email protected]>
Also:
webr::eval_js(..., await = TRUE)
, based on a similar mechanism.wss://
.This PR also removes the service worker communication channel. This channel has been deprecated for a while now, is never chosen in
Automatic
mode, and when explicitly selected emits a warning message saying it will be deleted soon.After this change the channel will indeed be gone and can no longer be selected at all.
Once everything has been setup, and a WebSocket proxy + SOCKS tunnel is running outside the browser: