Advice on architecture Phoenix LiveView, Channels, Presence

Hi all,

New to the elixir and phoenix realm.

I already have working apis, websocket applications with python backends and angular frontends using socket-io protocol on both.

Phoenix attracted me with the one codebase to rule them all as much as I can basically :slight_smile: at least saving me from defining my contract (Interface) in python and typescript. - I know you can skip to but we are all human and you don’t remember the properties of the class/object/struct you are working with across multiple projects.

Read the Programming Phoenix 1.4, Real-Time Phoenix book as well as a beginner in the pragmatic studio course.

LiveView is where my interest lies and can change some of my applications to that route but I have created several simple fun games too. Implementation is very close to angularJS/vueJS which I know very well and very smartly designed for server-rendering with minimal wire usage.

Channels, looking at the books and examples, writing native JS for channels, dom manipulation, no thanks, I can do so much more with angular and socket-io.

But solves my manually authenticating and checking authentication problem with namespaces and socket-io since it is always an afterthought for it.

Presence, great tool, I don’t have to keep state and broadcast events, yay, it will do it for me.

Ideally, I would be using all 3 of them with one LiveView

  • is this possible since they all implement different modules?
  • is it sane for scalability purposes?
app/lobby -> LiveView with lobby:* channel and presence so I know how many people are online
app/lobby/:id - LiveView with lobby:id channel to only receive updates for that channel and authenticate against it, presence only for that lobby instance.

am I overcomplicating this and should plug my authentication to LiveView and try to use Presence, PubSub directly from Phoenix?

ps: If any author of the books reading these forums, I have some feedback around the examples as these subjects tackled in all different chapters in complete isolation.

In real life, no modern application is that simple and requires socket, HTTP, third party, static payloads to work and function.