   @moduledoc false
 
   if Code.ensure_loaded?(:cowboy_websocket) and
-    function_exported?(:cowboy_websocket, :behaviour_info, 1) do
+       function_exported?(:cowboy_websocket, :behaviour_info, 1) do
     @behaviour :cowboy_websocket
   end
 

  def terminate(reason, _req, [handler | state]) do
    handler.terminate(reason, state)
  end

  defp copy_resp_headers(%Plug.Conn{} = conn, req) do
    Enum.reduce(conn.resp_headers, req, fn {key, val}, acc ->
      :cowboy_req.set_resp_header(key, val, acc)
    end)
  end

  defp handle_reply(handler, {:ok, state}), do: {:ok, [handler | state]}
  defp handle_reply(handler, {:push, data, state}), do: {:reply, data, [handler | state]}
  defp handle_reply(handler, {:reply, _status, data, state}), do: {:reply, data, [handler | state]}
  defp handle_reply(handler, {:stop, _reason, state}), do: {:stop, [handler | state]}
end

        {:ok, req, {handler, opts}}
    end
  catch
    kind, reason ->
      case System.stacktrace() do
        # Maybe the handler is not available because the code is being recompiled.
        # Sync with the code reloader and retry once.
        [{^endpoint, :__handler__, _, _} | _] when reason == :undef and retry? ->
          Phoenix.CodeReloader.Server.sync()
          init(conn, endpoint, opts, false)

        stacktrace ->
          exit_on_error(kind, reason, stacktrace, {endpoint, :call, [conn, opts]})
      end
  after
    receive do
      @already_sent -> :ok
