Suggestions for server side JS in Phoenix

I am working on building a web application that utilizes the WebAudioAPI (https://www.w3.org/TR/webaudio/) and Phoenix Channels to allow for collaborative/realtime audio synthesis/processing in the browser.

I was wondering if anyone has ideas/suggestions on how I could possibly add server side javascript processing (to offload some audio processing from the browser) into a Phoenix application? One thought I had was to integrate node.js plugin(s), but am also wondering if there are other ways of implementing this with only Phoenix.

2 Likes

Phoenix already comes with npm package stuff, though that does not exist in release, you could include it in a release build as well and do it there.

However, you could also link in a javascript engine via something like: https://hex.pm/packages/elixir_v8

Also, I certainly hope you are not going to allow user-submitted javascript to run, only your own. ^.^

2 Likes

@OvermindDL1 - thanks for your reply.

Doing it with npm just doesn’t feel right. I will definitely look into exilir_v8, might be just what i was searching for. And yes, javascript will NOT be user submitted :wink:

2 Likes

Also I know its examples use Mix.Project.app_path <> "/priv/, don’t do that, I’ve no clue why they do that and want to break releases, instead use :code.priv_dir(:my_app_name).

2 Likes