Could not understand this part of code

io.on(“connection”, (socket) => {
// connection starts
console.log(User ${socket.user.username} connected);

socket.on(“message”, async (text) => {
const message = await Message.create({ text, UserId: socket.user.id }); // saves
io.emit(“message”, { text: message.text, user: socket.user.username }); // sends
});
});