derek-zhou
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?
First Post!
julngomz
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.Socketfrom your ownMyAppWeb.UserSocketmodule.
Next, declare your
channeldefinitions and optionalconnect/3, andid/1callbacks 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?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









