Understanding sockets
The easiest way for us to start thinking about how real-time applications work in actual practice is to start building our own. Through this we can experiment and learn each of the moving pieces that are involved with implementing the real-time portion of our application. When we start off, our application we will have a user_socket.ex file in /lib/vocial_web/channels. If we open this file up we can get a good starting picture for how to start constructing our sockets and channels.
Sockets are responsible for setting up exactly how a client can connect and authenticate with the appropriate channels and topics. You can think of sockets as the actual means of connecting the client to the channel and topic (doing things ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access