     end
   end
 
-  defp channel_join(socket, channel, topic, auth_payload) do
-    instrument = %{params: auth_payload, socket: socket}
-
-    Phoenix.Endpoint.instrument socket, :phoenix_channel_join, instrument, fn ->
-      channel.join(topic, auth_payload, socket)
-    end
-  end
-
-  defp init(socket, channel, topic, reply, from) do
-    %{transport_pid: transport_pid, serializer: serializer, pubsub_server: pubsub_server} = socket
-    Process.monitor(transport_pid)
-
-    fastlane = {transport_pid, serializer, channel.__intercepts__()}
-    PubSub.subscribe(pubsub_server, topic, link: true, fastlane: fastlane)
-
-    log_join socket, topic, fn -> "Replied #{topic} :ok" end
-    GenServer.reply(from, {:ok, reply})
-    {:ok, %{socket | joined: true}}
-  end
-
-  defp log_join(%{private: %{log_join: false}}, _topic, _func), do: :noop
-  defp log_join(%{private: %{log_join: level}}, _topic, func), do: Logger.log(level, func)
-
-  @doc false
-  def handle_call(:socket, _from, socket) do
-    {:reply, socket, socket}
-  end
-
-  @doc false
-  def handle_cast(:close, socket) do
-    {:stop, {:shutdown, :closed}, socket}
-  end
-
-  @doc false
   def handle_info(%Message{topic: topic, event: "phx_leave", ref: ref}, %{topic: topic} = socket) do
     handle_in({:stop, {:shutdown, :left}, :ok, put_in(socket.ref, ref)})
   end

    end)
  end

  ## Handle results

  defp handle_result({:stop, reason, socket}, _callback) do

    args = [channel, {payload, from, socket}]

    case PoolSupervisor.start_child(socket.endpoint, socket.handler, from, args) do
      {:ok, pid} ->
        mon_ref = Process.monitor(pid)

