Hi,
we are getting 404 error on /socket
i am able to see all the configuration are correctly configured as per documentation.
we are using 1.3.0 phoenix version.
defmodule WS2Web.Endpoint do
use Phoenix.Endpoint, otp_app: :ws2
socket "/socket", WS2Web.UserSocket
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files in production.
plug Plug.Static,
at: "/", from: :ws2, gzip: false,
only: ~w(css fonts images js favicon.ico robots.txt)
# Code reloading can be explicitly enabled under the
# :code_reloader configuration of your endpoint.
if code_reloading? do
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
plug Phoenix.LiveReloader
plug Phoenix.CodeReloader
end
defmodule WS2Web.UserSocket do
use Phoenix.Socket
channel "chat:*", WS2Web.ChatChannel
transport :websocket, Phoenix.Transports.WebSocket,
timeout: 45_000,
check_origin: false
def connect(%{"token" => token}, socket) do
case Guardian.Phoenix.Socket.authenticate(socket, WS2.Guardian, token) do
{:ok, authed_socket} ->
{:ok, authed_socket}
{:error, _} -> :error
end
end
def connect(_params, _socket) do
:error
end
still can’t figure out why we are unable to connect and it throws 404 error for websocket connection
Thanks