To add interaction to the application, we must create the server first. We will use the
ws package to easily create a websocket server. On the websocket, we can send messages in both directions. These messages are objects converted to strings with JSON, just like in the previous chapters.
In the previous chapter, we wrote a connectionless server. For every request, a new connection was set up. We could store a state using a session. Such session was identified with a cookie. If you were to copy that cookie to a different computer, you would have the same session there.
Now we will write a server that uses connections. In this way, the server can easily keep track of which user is logged in and where. The server can ...