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 ...

Get Phoenix Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.