Is it possible to add a custom channel to the liveview socket?

LiveView by default use the /live socket. A user socket by default use the /socket socket. A socket is further divided into channels that don’t interfere with each other. Can I reuse the live socket and just add a few channels of my own, assuming I avoid all the topic ids used by LiveView?

1 Like

I know this is dated but did you figure this out?

I was looking at the Phoenix.LiveView.Socket docs and it said the following.

To share an underlying transport connection between regular Phoenix channels and LiveView processes, use Phoenix.LiveView.Socket from your own MyAppWeb.UserSocket module.

Next, declare your channel definitions and optional connect/3, and id/1 callbacks to handle your channel specific needs, then mount your own socket in your endpoint:

socket "/live", MyAppWeb.UserSocket,
  websocket: [connect_info: [session: @session_options]]

I also have a custom user socket where I want to do custom channels and message routing.

How did this go?