Pub-Sub envelope subscriber in Elixir

defmodule Psenvsub do
@moduledoc """
Generated by erl2ex (http://github.com/dazuma/erl2ex)
From Erlang source: (Unknown source file)
At: 2019-12-20 13:57:30

"""

def main() do
{:ok, context} = :erlzmq.context()
{:ok, subscriber} = :erlzmq.socket(context, :sub)
:ok = :erlzmq.connect(subscriber, 'tcp://localhost:5563')
:ok = :erlzmq.setsockopt(subscriber, :subscribe, "B")
loop(subscriber)
:ok = :erlzmq.close(subscriber)
:ok = :erlzmq.term(context)
end

def loop(subscriber) do
{:ok, address} = :erlzmq.recv(subscriber)
{:ok, contents} = :erlzmq.recv(subscriber)
:io.format('[~s] ~s~n', [address, contents])
loop(subscriber)
end

end

Psenvsub.main