3 ms·
The message passing is, IMO, the biggest win you get from the process model. In the process model, you have the LiveView process, which sits there, listening fo
by OkayPhysicist 3y ago
The message passing is, IMO, the biggest win you get from the process model. In the process model, you have the LiveView process, which sits there, listening for messages, which it can receive both from the browser client, or from independent going-ons in the backend, quite symmetrically. To the programmer, it looks just like any other process that you'd be used to using everywhere in Elixir, which provides useful interop with things like Task.async, which sends a message back to it's linked process on completion, or other libraries that are completely unaware of LiveView.
You could simulate the same thing with a dictionary lookup scheme, but A) it would be far more complex, because of the lack of native message passing support, and B) the you'd miss out on the symmetries and interop, because the rest of your program wouldn't be using message passing.