Communicating between phoenix (server) and elixir app (laptop)

I’m new to Elixir… I have tried to find documentation / how-to’s on this, but failed. Any pointers on how to “actually” do the following?

I have an Elixir Application that I can send messages to and it will in turn send OSC (Open Sound Control) messages to another computer. This app runs on a laptop (in the same WLAN as the other computer - one that will generate sound)

On a server, I have a Phoenix application that has a web ui used to control the sound being generated. It should send messages to the Elixir app on the laptop.

What is the preferred way for those apps to be configured, to start up so that they discover each other.
How do I best organize the code?
Is this one umbrella app (phoenix + mine) that I start on both machines?
If not, how does the Phoenix app know what messages it is able to send? … I have gotten two iex processes on the server and the laptop to talk to each other, I’m just wondering what the best practice is to actually build and deploy something like that.

I have read through the Phoenix / Elixir books by PragProg and the upcoming Beta book (https://pragprog.com/book/lhelph/functional-web-development-with-elixir-otp-and-phoenix) and I have all the individual pieces (more or less) up and running.

thanks
Jens-Christian

1 Like

Are you able to assume that server and client will always be on the same local network?

If not, Phoenix Channels would probably be a good place to start, websockets under the hood, this would be a good client library to interface with the library, https://hex.pm/packages/phoenix_gen_socket_client.

If they are always on the same network, you could use something like https://github.com/bsmr-erlang/nodefinder and use Elixir/Erlang built in distributed functionality.

3 Likes

no - they are on different networks. The server runs somewhere in the cloud, the client will be running on a conference network

Thanks for the pointers - I thought about using Phoenix channels, but haven’t investigated yet. The library looks exactly what I need

/jc

1 Like