Closed guest271314 closed 2 years ago
If this just needs the ability to read from stdin and write to stdout, then yes, that should work today.
I am using popen()
. My attempts to compile to WASM so far have thrown errors on can't find iostream
include and popon()
is undefined.
WebAssembly Explorer did produce this .wat file. An error was generated concerning popen()
. I am not sure how to run the file via wasmer, et al. when I connect to the host from the browser.
As a practical matter, I am not sure if it is even worth compiling to WASM when I can run the C++ code now.
WASI does not yet support popen
. If compiling C++ to native works for you, then there's probably not much value in compiling to Wasm.
Is it possible to use WebAssembly/WASI as a Native Messaging (https://developer.chrome.com/docs/apps/nativeMessaging) host?
I currently have working C++ code https://github.com/guest271314/captureSystemAudio/blob/master/native_messaging/capture_system_audio/capture_system_audio.cpp that I use to capture entire system audio output or specific device audio output using
popen()
and PulseAudioparec
, send to the browser as JSON using the Native Messaging protocol https://developer.chrome.com/docs/apps/nativeMessaging/#native-messaging-host-protocol where the audio is passed to aMediaStreamTrackGenerator
which can be streamed to peers using WebRTC and encoded to Opus in WebM container or MP3.Is the above possible within the scope of WebAssembly/WASI?