Light communication from pc/app to arduino
Doing bit stuffing can prevent timing problems when you are sending a lot of 0s or 1s in an row. Alternatively use Manchester encoding (slower).

On the browser side, I'd suggest using &lt;Canvas&gt;. Combine this with requestAnimationFrame which gives you a very accurate timestamp as an argument. Though you have to check for support as older browsers don't support that.