This project is meant to be a very simple and basic example of process communication between nodes in a cluster using Elixir.
You can install the required dependencies with asdf
(you'll need the elixir
and erlang
plugins).
$ asdf install
You'll need to connect your node to a cluster. To do that, start the IEx session
with the --name
and --cookie
options:
$ iex --name example@0.0.0.0 --cookie 123 -S mix
You can also use the included start
script, that will execute the above
command for you:
$ ./script node0 # iex --name node0@0.0.0.0 --cookie 123456 -S mix
By naming your nodes as nodeX
, the .iex.exs
will automatically try to
connect with nodes node0
all the way to node9
.
The provided .iex.exs
is already configured to import all functions from
Messenger.IExClient
.
signin [user]
: sign-in in the cluster with the given user namesignout
: sign-out from the clusterwhoami
: returns the current user that's signed ininbox
: prints the inboxsent
: prints all sent messageslast_msg
: prints the last messagemsg [recipient], [message]
: send the givenmessage
to therecipient
messenger
source code is released under Apache License 2.0.