Chapter 01 :
CONCEPTS / RE-Thinks
- SPA is a distributed system !
- SPAs have shared states.
How Elixir changes SPA?
-
Phoenix Channels = using BEAM for long lived HTTP connections! (as opposed to stateless) - using
socket.assigns
- think of channels as joining channels on slack.
-
sockets
function as routers where channel routes are defined. (auto generated by Phoenix) -
Phoenix.PubSub.PG2 - using BEAM native message passing to broadcaste and coordinate updates – where the complexity adds up in SPA !
- Leveraging the best of the Erlang VM.
-
Client for requesting data to SPA CAN BE anyone - watch, app, website, IoT !
- Anyone who subscribes to a
channel
→topic:subtopic
is a client.
- Standard (read : best practices) infrastructure to deal with
auth
. - Buggy network connections => Phoenix uses ETS-tables (BEAM’s strength) to ensure
fault tolerance
!
Source : from Chapter 01 + Channels — Phoenix v1.5.12.
Happy Reading!