te_chris
Sharing a channel between clients (LiveView + Mobile apps)
Hey everyone. I’m working on a service that’s currently LV but will eventually have an app. The interaction will basically be the same. This has had me thinking about how I could avoid duplication with client/server interactions, while still offering a similar responsive/reactive experince on both platforms.
I’d like to avoid having to build a separate API (beyond bare necessities) and LV stack if possible so my question is: can I treat a channel as an ‘API’ interface that the LV and the App could both talk to and does anyone have any experience of this, advice/war stories they can share?
Most Liked
LostKobrakai
It just seems like duplication to define how these events are handled twice (once on the channel and once on the LVs).
That sounds rather wrong tbh. Event handlers in LV should handle the web ui specifics, not domain level functionality. You shouldn’t need to duplicate any logic to another API interface. That stuff should be in lower levels of your codebase. Copying boilerplate (e.g. calling into your core modules) is imo the right way to handle this, as eventual divergance of interfaces is to be expected.
Popular in Discussions
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








