(Phoenix.Router.NoRouteError) no route found for GET /socket/websocket

Working though book Programming Phoenix. No problems until the Channels chapter. I followed instructions but I am getting this error in the console now:

[info] GET /socket/websocket
[debug] ** (Phoenix.Router.NoRouteError) no route found for GET /socket/websocket (RumblWeb.Router)
(rumbl 0.1.0) lib/phoenix/router.ex:406: RumblWeb.Router.call/2

I have also downloaded sample code from GitHub but the router.ex file essentially looks the same as mine.

If you have any advice on how to proceed, I would appreciate the assistance.

3 Likes

what about endpoint.ex? There should be something like

  socket "/socket", MyAppWeb.UserSocket,
    websocket: [connect_info: [:peer_data]],
    longpoll: false
6 Likes

Yes it was endpoint.ex. I made some changes there, commenting out what was there and adding a line:

#socket “/live”, Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]
socket “/socket”, RumblWeb.UserSocket