I am trying to assess the feasibility of the following setup using node js as a mouse recorder. I know that there are simple JS mouse recorders with timers and arrays, but they are not efficient enough when it comes to timing (due to ms deviations in the js timer class).
Lets assume I want to be able to do the following:
1) Instead of pushing the current mouse position every change, I want to buffer it locally and push the data in a set interval (e.g. 5sec). Is that even possible?
2) If so, the stream of this mouse movement is saved as a binary file. The binary file could then be streamed to another client.
Generally I have a difficulty in understanding streams in general. To my understanding streams are just chunks of data that are sent to the client. Is this correct?
1) Yes, its possible, I would recommend you to use Event Emitter <-> Event Listener logic.
2) Sure, you can do it. But tell us more clear about what are you trying to do. Meanwhile you can take a look into socket.io solution for streaming data, or npm install ws. Again , it very depends of what you're tying to develop.
Also there are much more complex and powerful solutions based on RTMP protocol, but I've no idea why you will need it here to send couple of bytes from one side to another. Also you may take a look to broadcaster idea, if you have to send those data chunks to multiple subscribers.