title: Socket won't connect to Endpoint
body: <pre><code>var socket = new Socket("localhost:4000")
  socket.connect()
  </code></pre>
  
  <p>Returns <code>WebSocket connection to 'ws://localhost:4000/ws' failed: Error during WebSocket handshake: Unexpected response code: 404</code></p>
  
  <p>But I do have the socket on the <code>/ws</code> endpoint, right?</p>
  
  <pre><code>defmodule Sapphire.Endpoint do
    use Phoenix.Endpoint, otp_app: :sapphire
  
    socket "/ws", Sapphire.MomentSocket
  
    plug Plug.Static,
      at: "/", from: :sapphire, gzip: false,
      only: ~w(css fonts images js favicon.ico robots.txt)
  
    if code_reloading? do
      socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
      plug Phoenix.LiveReloader
      plug Phoenix.CodeReloader
    end
  
    plug Plug.RequestId
    plug Plug.Logger
  
    plug Plug.Parsers,
      parsers: [:urlencoded, :multipart, :json],
      pass: ["*/*"],
      json_decoder: Poison
  
    plug Plug.MethodOverride
    plug Plug.Head
  
    plug Plug.Session,
      store: :cookie,
      key: "_sapphire_key",
      signing_salt: "hW1bFEcR"
  
    plug Sapphire.Router
  
  end
  </code></pre>
  
  <p>It should be able to connect to that endpoint, but for some reason it can't reach it at all.</p>
  
  <p><code>[info] Running Sapphire.Endpoint with Cowboy on http://localhost:4000</code></p>