The processing net library can be used to create instances of server and client. See examples examples, NB: you should launch the server sketch shared_canvas_server.rb before the shared_canvas_client.rb. Lines drawn on the sketch client, are repeated on the server, see below.

Client / Server