Live Connections

9/12/19

Alan Tirado
@boxman0001 - Slack
@asInMyInitials - Twitter
@boxman0617 - Github
Who am I?
Outline
- Phoenix Channels
- Socket Management
- Channel Management
- UI Layer
- Final Thoughts
First Off
Show off the UI!
Phoenix Channels
WS Channels
https://tinyurl.com/y5jyv3es
Socket Management
What are we managing?
-
Socket through Context
-
Auth Token
-
onClose
-
onError
Pain-points
-
SSR
-
Mounting dependencies
-
Handling app closing
Channel Management
What are we managing?
-
Channel instance
-
Joining handling
-
Join crash handling
-
Channel crash handling
-
"on" subscriptions
-
mount/unmount
Pain-points
-
Waiting for Socket creation
-
Managing Channel status
-
Handling Channel crashes
-
Long join handling times
UI Layer
Key Points
-
LiveConnectionsSelector components owns their abstraction
-
Only things that change should re-render
-
LiveConnections store manages the status of each Channel
-
Statuses are set by events
-
@computed values derive specific state based on base LiveConnections observables
-
@computed values offer safe abstraction over complex logic
Pain-points
-
Large lists
-
Statuses reflect shallow Channel status
Final Thoughts
-
Stores should hold truly global state
-
@computed values in components offer safe abstraction over global state
-
Use observer and Observer as deep in your tree as possible
-
Stores should offer abstraction over user actions (no UI needed)
-
Can it be refactored easily?
Questions / Comments?
Thanks!
Live Connections
By Alan Tirado
Live Connections
Live Connections in Logistics overview
- 407