Node.connect(:bob@bobmachine)
alice = self()

Node.spawn(:bob@bobmachine, fn ->
  1..10_000
  |> Enum.map(fn x ->
    IO.puts("Hello there")
    Process.sleep(1000)
    send(alice, :hoi)
  end)
end)

defmodule T do
  def receiver() do
    IO.puts("Receiver waiting for message")

    receive do
      m ->
        IO.puts("Message: #{inspect(m)}")
    end

    receiver()
  end
end

spawn(fn -> T.receiver() end)