I have a room_channel
defmodule AuthWeb.RoomChannel do
use Phoenix.Channel
def join("room", _message, socket) do
{:ok, socket}
end
def join("room" <> _private_room_id, _params, _socket) do
{:error, %{reason: "unauthorized"}}
end
end
In the user socket I have room_channel
channel "room", AuthWeb.RoomChannel
In the socket.js file I have this
let channel = socket.channel("room", {})
channel.join()
.receive("ok", resp => { console.log("Joined successfully", resp) })
.receive("error", resp => { console.log("Unable to join", resp) })
export default socket
But when I’m doing this
wscat -c 'localhost:4000/phoenix/live_reload/socket/websocket?vsn=2.0.0'
Connected (press CTRL+C to quit)
> ["1", "1", "room", "phx_join", {}]
< [null,"1","room","phx_reply",{"response":{"reason":"unmatched topic"},"status":"error"}]
what am I missing here?