node.js - XMLHttpRequest detect new data from server before res.end() -


is possible detect new data server sent? example, express.js:

res.write('processing 14% or something'); 

and display on page progress bar.

edit:

my original question bit confusing let me explain situation. have created page users can upload song files. these files converted (using ffmpeg) .ogg , .mp3 files web. conversion takes long time. possible send real time data conversion client using same xmlhttprequest sent files?

if understand correctly trying implement event based actions. yes node.js has got excellent web socket libraries such socket.io , sack.js

you need understand nodejs event driven pattern.

websocket protocol helps maintain full duplex connection between server , client. can notify clients when action happens in server , similar can notify server when action happens in client. libraries provide flexibility broadcast event connected client or selected ones.

so emit , on using often. go through documentation, not take time learn. let me know if need help.


Popular posts from this blog