Create a socket server that connects to multiple browser clients and sends drawing data between them to create a synchronized drawing application.
-
Clone this repository on to your local machine.
-
Run
npm installto get the Socket.io dependency.
-
The client should accept mouse input, and draw a line when the user clicks and drags on the canvas.
-
Any lines drawn by a client should be sent to the other clients and reproduced on their screens.
-
Places to write your code have been marked in
public/main.jsandserver.js -
Be prepared to answer some follow up questions after you complete the task.
-
I will be available for the entire time you are working on the task to answer any questions you have.
lineTodocumentation: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineToclearRectdocumentation: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clearRect
- Chat client example: https://github.com/Automattic/socket.io/tree/master/examples/chat
- Server documentation: https://socket.io/docs/v4/server-initialization/
- Client documentation: https://socket.io/docs/v4/client-socket-instance/