There are all kinds of ways to do it. You can use ServerSocket on the server app to accept incoming connections.
A simpler and more reliable solution is to use MQTT for the communication. You can run the broker inside the server app.
ok, I did follow the chat sample and worked great, I try to use a mqttws31.js for a MQTT browser client with the chat sample, but I can't connect. I want to use a MQTT client on the web browser and I can't figure it out with the Simple Chat sample, any help would be appreciated.