The following code in node.js does not log all incoming data inside the brackets, rather, it breaks the data into chunks. So for example, if the incoming data is ABCDEF...XYZ it logs the data as [ABC][DEF]...[XYZ] rather than [ABCDEF...XYZ]. The data is much larger of course, the alphabet is just an example.
How should I write this so that all incoming data is logged once inside the brackets and not in parts?
chatServer.on('connection', function(client)
{
client.on('data', function(data)
{
console.log('[' + data.toString() + ']');
})
})