Hacker News new | ask | show | jobs
by A1kmm 5426 days ago
The front ends seem to get desynchronised when two incompatible concurrent edits happen; this is a difficult issue to resolve, but one solution would be to change the data flow so local edits are drawn by the client on a transparent canvas, get sent to the server, and then get drawn on the underlying main canvas only when they are sent back from the server. The transparent canvas can be reset by the client at that point (you might need some synchronisation mechanism for this), so all users will end up having consistent state once edits have been processed by the server.
1 comments

This is what we do for http://300lin.es ;)

edit: My God, it's full of cocks.

Quit hint: it's too easy to make a DOS by quickly drawing hundreds of lines in the same spot. It doesn't take more than two minutes and regular writing or drawing is too slow and ends up erased before finished.

Maybe limit the number of lines an user can draw during a certain time?

Thanks :) Yeah, we limit the length of line to try to avoid scribblers. We thought of rate-limiting the number of lines too, and adjusting the limit, so the first time you hit the limit you're stopped for 1 seconds, next time for 2 seconds, then 4, 8, 16 and so on.

Would probably work quite well.

PS is your hostname 'bd222edited for privacy.com.br' ?

Yep, that would be me. Sorry if I broke something, it started as an attempt to remove the random lines obscuring the drawings and text. When I noticed the fade out effect on the lines, I had already erased everything D:
yeah no worries, I just wanted to check that it wasn't someone trying to attack the site :)
yeah it's hilarious what people's doodles actually end up turning in to. Everything's logged on the server, I'm planning to do a stop-motion style playback video to put up on youtube eventually.
Would love to see that, please post on HN when you do
Really glad to see that people are interested in this!

We're actually planning to write up a little blog post about our learning experience with NodeJS etc, maybe open-source the code, and then post that to HN/reddit/etc.

We've actually been waiting for a good opportunity to 'launch' it properly. Just as a fun side-project, no real business in 300lines as it stands, though we'd like to spin off a simple collaborative whiteboard app at some point.

Thanks for the feedback :)

:D