-
Notifications
You must be signed in to change notification settings - Fork 74
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 for external database networking #129
Comments
Latest networking upgrade from Emscripten would facilitate supporting DBI. Please take a look on: WordPress/wordpress-playground#116 |
FYI, an example of RDBMS connection in WASM : WordPress/wordpress-playground#119 |
Better support for networking is an interesting potential development direction for webR, but unfortunately I can see two immediate issues that means this particular approach used by the Wordpress team would not easily transfer to webR.
Even if we could easily use WebSockets in the webR worker thread, for this to work requires either a database server to support listening for WebSocket traffic rather than TCP socket traffic, or a proxy running on a user's local machine outside the browser and webR to translate the socket traffic from one to the other. In my opinion running a proxy server outside of the browser, while a technical solution, does not fit within the primary goals of the webR project. At the moment, we are emphasising development for a self-contained solution without the need to install external software like proxy servers on end user devices. That leaves the potential solution of database software that supports WebSocket connections natively. I am not aware if any such database servers already exist and are in popular use - I will make a mental note to research this. I think this solution would match better with our goals for webR but first requires serious changes to current database software by the developers of those projects, rather than any short term solution that can be implemented in webR. |
@georgestagg Thanks a lot for this clarification. However, as you can understand it, support of persistent storage and networking database are very important for WebR.
|
Others are exploring the JSPI API https://v8.dev/blog/jspi instead of Asyncify to link a synchronous WASM with Async JS Web API. I think it's something you should also explore. |
@htiuser Stack-switching is on our radar but it's too early at the moment. |
Hello @lionel- and @georgestagg , while I can see DBI in https://github.com/r-wasm/webr-repo/blob/main/repo-packages |
Hi @HTUser-1 , The latest version of webR supports building sqlite for Wasm, for use by Wasm R packages, and RSQLite should now be available at https://webr.r-wasm.org/latest/. This will ship with webR v0.2.0. OPFS is on my radar, I expect work will commence some time after 0.2.0 is released, along with any related minor patch releases. As mentioned in previous comments, raw socket/TCP access from Wasm requires an external proxy server to convert WebSocket traffic into traditional network traffic. We currently consider this out of scope in the short term, but we may revisit it in the future once the webR project is more mature. |
Hello @georgestagg,
I think that it's something you should explore and inspire. It's also related to: #490 (comment) |
@gregvolny what about duckdb? duckdb-wasm works just fine with with shinylive right now App. It also looks like very soon there will be support for more restricted / authenticated access via presigned URLs and OPFS support duckdb/duckdb-wasm#1856. Something similar should be doable with sqlite as well, though you will be using JS to interact with it not R, similar to what I'm doing above. Though this might not be relevant to you if you're not interested in shinylive but webR instead? Either way maybe this does help just coming from your comment on the shinylive repo. |
WebR Support of relational database will be a very important milestone, even if, Emscripten full support of Sockets in browser environment limit this task a lot. However, in his latest version they used some workaround and right now, this idea is more feasible using one of the followings ways:
a) POSIX TCP Sockets over WebSockets;
b) Full POSIX Sockets over WebSocket Proxy Server;
The Wordpress WASM team had some results by using fetch()
WordPress/wordpress-playground#85
other, Postgres WASM use this https://github.com/benjamincburns/websockproxy
but on x86 virtualization on the browser.
The text was updated successfully, but these errors were encountered: