Message server
Running
Starting servers
Server ID (SERVER_ID) and remote servers (SERVERS) are provided as environment variables.
Server 1
SERVER_ID=1 SERVERS="2:localhost:4001" PORT=4000 mix run --no-halt
Server 2
SERVER_ID=2 SERVERS="1:localhost:4000" PORT=4001 mix run --no-halt
Sending messages
From Server 1
curl -X POST http://localhost:4000/api/messages -H "Content-Type: application/json" -d '{"from": "1-bender", "to": "1-zoidberg", "message": "Dreams are where elves and gnomes live!"}'
curl -X POST http://localhost:4000/api/messages -H "Content-Type: application/json" -d '{"from": "1-bender", "to": "2-nibbler", "message": "Bite my shiny metal ass!"}'
From Server 2
curl -X POST http://localhost:4001/api/messages -H "Content-Type: application/json" -d '{"from": "2-nibbler", "to": "1-bender", "message": "I am Nibbler, agent of the Nibblonian fleet."}'
Description
Languages
Elixir
100%