Node.js port listening and reading from stdin at the same time
I have a socket server in Node.js and I'd like to be able to read from stdin at the same time the server is listening. It works only partially. I'm using this code: process.stdin.on('data', function(chunk) { for(var i = 0; i < streams.length; i++) { // code that sends the data of stdin to all clients } }); // ... // (Listening code which responds to messages from clients) When I don't type anything, the server responds to messages of the clients, but when I start typing something, it isn't until I press Enter that it continues with this task. In the time between starting to type something and