i just thought about it and i had to remind me about tcp itself. so. the question is not how to force tcp to send one byte at a time, but what do you want to send. the way how to use tcp ist:
- define your message format (i.E. HTTP does it)
- use tcp as it is. tcp will break up your messages if they dont fit into a single data-package so you'll have to merge may be
- parse it to your message format.
in your case i would do on server something like this
connection.on('data', function(data){
data.split('\n').forEach(function(message){
console.log('message received:'+message);
});
});
and on client just send 'a\n' so i defined my message format as \n-separated string.
its the way of tsp/ip or even most of protokoll families in OSI-meant way not to tweak the underlying protokoll for higher-level purposes, but to define your own one on top of them. Thats how internet and all the stuff works.