Slide 4
Slide 4 text
USER SOCKET MODULE
▸ What is a User Socket?
▸ What do we get out of the box?
PRESENCE & CHANNELS BY @JESSICAEWEST
# lib/retrodoc/endpoint.exsocket
"/socket", Retrodoc.UserSocket
**Poll audience about sockets**
Socket: In a web context, a socket is an open connection between a user’s browser (the “client”) and our app (the “server”). With a typical web app, the client makes an
HTTP request (e.g. GET /home) to the server, the server returns a response (e.g. the HTML for the home page), and the connection is closed. A socket allows the client-
server connection to remain open so the client and server can continue to exchange messages as long as the user remains on the page.
Our User Socket Module: When a browser opens up a socket connection to our app, the UserSocket’s job is to identify which “user” that is, usually by some means of
authentication. Conceptually, this is similar to how a controller in an MVC app identifies and stores the current_user.