In this part, I will show you how to use your existing express-based node.js app to create a chatroom backend with WebSocket support.
Now we have a chat system capable of broadcasting a message received via websockets to all other connected clients, it saves the message to the database and retrieves the last 10 messages to give context to every new user who joins the chatroom.