Hello,
The Processing SharedCanvasClient and SharedCanvasServer examples can be adapted for this:
I just added data (1 and 2) to identify each client (1 or 2) and checked for that on server to set color of line.