     Logger.debug Poison.encode_to_iodata!(worker_info, pretty: true)
     Logger.debug inspect(self)
 
-    remote_ip = socket.assigns[:conn].remote_ip
-    ActiveWorkers.update_joined_worker_info(%{
-      join: worker_info
-            |> Map.put(:remote_ip, remote_ip |> Tuple.to_list |> Enum.join("."))
-            |> Map.put(:country_code, country_code(remote_ip))
-    })
-    socket = assign(socket, :worker_info, worker_info)
+    socket = save_worker_info(socket, worker_info)
+    send(self, :after_join)
 
     {:ok, conn} = AMQP.Connection.open
     {:ok, chan} = AMQP.Channel.open(conn)

    :ok
  end

  defp country_code(ip) do
    case MicrocrawlerWebapp.IpInfo.for(ip) do
      {:ok, info} -> elem(info, 0)
      :error      -> ""
    end
  end
end


  def join("worker:" <> _private_room_id, _params, _socket) do
    {:error, %{reason: "unauthorized"}}
  end

  def handle_info(:after_join, socket) do
    socket
    |> send_worker_info
    |> noreply
  end

  def handle_info({:basic_deliver, payload, meta}, socket) do
    Logger.debug "Received from rabbit - #{payload}"
    push socket, "crawl", %{payload: payload}
    {:noreply, assign(socket, :rabb_meta, meta)}
  end

  def handle_info(msg, socket) do
    Logger.debug inspect(msg)
    Logger.debug inspect(self)
    # IO.inspect socket
    {:noreply, socket}
  end

  def handle_in("ping", payload, socket) do
