PubSub instead of polling in liveview?

Hi,

Sorry, I did not look at the LiveView tutorial.
I have worked with polling model for music player a couple of years ago: local_assistant/lib/local_assistant/player/player.ex at f02e6779d011a612a317d41a97aad4c330a7034d · RomanKotov/local_assistant · GitHub

This was a local player. We used it in the office to play tracks.
Pros:

  • Easy to implement.
    Cons:
  • The player I used to play track (mopidy) could be blocked on long operations. For example, loading very large playlist could crash the whole application. Or the UI was unstable.

I took the issues into account and created another application to play music, and some other stuff (it will be Elixir-based Smart Home). Now it uses PubSub (indirectly) and the other player (mpv).

New examples:

I like how newer approach. It works better :slight_smile:

Have streamed the implementation process some time. Here is a thread about the Exshome: Exshome - DIY Elixir Smart Home

Hope this helps :slight_smile:

1 Like