Setting up acknowledgments really isn't that bad if you already have a listener in place. All you have to do is make a quick change to the listener and a quick change to the emitter, and everything will work as expected.
Now in this case, the listener happens to be on the server and the emitter is going to be on the client, but acknowledgments also work in the other direction. I can emit an event from the server and I can acknowledge it from the client.
In order to set this up we are going to emit a createMessage event over inside index.js using socket.emit, and we're going to pass in the same arguments we would otherwise. The first one is the event name, createMessage, and we're going to pass in some valid data, an object with those two properties. We can set from equal to something like Frank, and we can set a text property equal to something like Hi:
socket.emit('createMessage', {
from: 'Frank',
text: 'Hi'
});
Now with this in place we have a standard event emitter and a standard event listener. I can go ahead and start up the app using nodemon and we can make sure everything is working as expected, nodemon server/server.js:
nodemon server/server.js
Once the server is up we can visit it in the browser, I'm going to open up the Developer Tools as well. Then we're going to go to localhost:3000, and you can see over inside of the Terminal we have createMessage showing up, and we also have newMessage showing up here. We have the newMessage for our little Welcome to the chat app greeting, and we have the newMessage from Frank, which we emitted:

Now the goal here is to send an acknowledgement from the server back to the client that we got the data.