3 parts of routing a websocket
First, there's a socket declaration in the
socket "/socket", AppName.UserSocket
Second, there's a transport declaration in the
transport :ws, Phoenix.Transports.WebSocket
Now, the websocket will be available at the url
ws://localhost:4000/socket/ws the final path segment of the url being added by the first argument of the transport declaration.
Finally, the channel topic is also declared in the
channel "app_topic:*", AppName.MyChannel
Now every json body that has a topic attribute of
app_topic will be routed to
MyChannel.AppName where it will be handled appropriately based on the event attribute.