You might want to check out how supercollider.js does it:
If I remember correctly, you need to get your parenthesized, multi-line code, append the escape char that means “execute”, and send it to sclang:
I have never used Elixir, so I can’t write any code example, sorry