I try to implement an online painter, i.e. there is a certain area where anyone can draw anything.

How to make, that after change (one person drew) and changes received everything?

  • 3
    one . Formalize all possible types of changes by some teams (for example, the black line of thickness 1 from x1, y1 to x2, y2). 2.Send such changes to all participants and apply to the canvas in their applications. 3. Make sure that messages are global ordered (to read about the order in distributed systems: Lamport clock / vector clock, for example). - Nofate ♦

1 answer 1

The university had a similar task. As one of the ways: after a person clicks on a region and leads along this region (draws a line), the handler reads all coordinates, draws small straight lines between these coordinates, an array of coordinates and a line drawn by the user are obtained. Then there are several options: either every time the point is read, send to the server, which, in turn, sends to everyone, or as soon as the user releases, send the entire array at once.