   end
 
   def websocket_init(_TransportName, req, _opts) do
+    IO.puts("websocket_init: #{inspect(req.port)}")
     ws_broadcast(:nodes, {:new, :erlang.pid_to_list(self())})
     {:ok, req, :undefined_state }
   end

        [current_function: {:cowboy_websocket, :handler_loop, 4}] ==
        Process.info(b,[:current_function]) end)
  end
  
  @doc """
  Broadcasts a `msg` to all active websockets supervised by ranch_conns_sup.
  """
  def ws_broadcast(type, msg, opts \\ []) do
    ws_list |> Enum.map(fn(pid) -> Process.send(pid,{type,msg,opts},[]) end)
  end

  ## Errors

  @doc """
  Gets the list of all active websocket PIDs from the ranch supervisor.
  """
  def ws_list(port) do
    IO.puts("porty: #{inspect(port)}")
    {_site, info} = get_info(port)
    IO.puts("infoy: #{inspect(info)}")
    Process.whereis(:ranch_sup) 
      |> Supervisor.which_children
      |> Enum.find(fn(x) -> elem(x,0) == {:ranch_listener_sup, :http} end)
