NATS - Elixir Client
Here is a sample configuration to connect to your NATS server.
# In your config/config.exs file config :nats, Nats.Connection, url: "mynatsserver.com", port: 4222, verbose: true, pedantic: false, user: "aforward", password: "nicetry", tcp: [:binary, active: false],
To play around with the client, start your NATS server, for example (using docker)
docker run -it -p 4222:4222 -p 6222:6222 -p 8222:8222 --name=nats nats:0.6.6
The output should look similar to
 2015/09/07 21:49:00.431970 [INF] Starting gnatsd version 0.6.6  2015/09/07 21:49:00.432082 [INF] Starting http monitor on port 8222  2015/09/07 21:49:00.432191 [INF] Listening for route connections on :6222  2015/09/07 21:49:00.432285 [INF] Listening for client connections on 0.0.0.0:4222  2015/09/07 21:49:00.432356 [INF] gnatsd is ready
Now start your iex from the elixir-nats directory
iex -S mix
You should see your nats server properly connected (make sure to get the configs right above)
[info] Attempting to connect to NATS Server: 192.168.59.103:4222 [info] Connected.
Now you can send messages to the server
I am still figuring out the protocol, so the only way to see that the connection was actually established was to send an invalid message and watch the NATS server report the error
Which would report an error similar to
 2015/09/07 21:51:45.962684 [ERR] 172.17.42.1:42032 - cid:1 - Error reading from client: Client Parser ERROR, state=0, i=0: proto='"GARBLE\r"...'
Next steps are to figure out protocol and wrap in meaningful helper functions.