Is there any reason you don’t want to use MQTT for this? There are at least two popular implementations in Erlang, VerneMQ and EMQ.