mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #530] [Question] Wasm / Node.js support #338
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#338
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @codetheweb on GitHub (Oct 11, 2020).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/530
I'm new to Rust, and I was wondering how hard it would be to compile this into WebAssembly for usage with Node.js / browsers. I tried briefly using
wasm-pack build(after addingcrate-type = ["cdylib"]to Cargo.toml) and it just spit out a bunch of errors. I'm not experience enough to know whether this is relatively easy with a little bit more configuration or if it would require rewriting code.Any feedback / help is appreciated.
@codetheweb commented on GitHub (Oct 13, 2020):
After some more investigation, it seems that the main blocker on this is the fact that raw TCP sockets are used (which are supported in Node.js but not the browser).
If you want to run it in a browser, it might be possible to use Emcripten which polyfills sockets to web sockets. You'd also then need something like websockify on a server.
In theory it should be possible to run on Node.js using network calls from WASI but I'm not sure if WASM compilers work with that yet. This is a very rapidly changing space.
So TL;DR is that if you want Node.js support it looks like it might be easiest to just re-implement in JS.
@schickling commented on GitHub (Jun 24, 2022):
Thanks for sharing your investigations @codetheweb.
Looks like there's some ongoing work on bringing socket support to Wasi.