bootcamp-second-project / draw-stuff

draw with ur friends :)
1 stars 1 forks source link

Websocket #5

Closed japankid-code closed 3 years ago

japankid-code commented 3 years ago

websocket will wrap around server. it listens to events and broadcasts them in other users clients. Broadcasting drawing events to server will be gated by checking the user's ID against the currently drawing user's ID to allow only the drawer to broadcast events on the drawing board.

japankid-code commented 3 years ago

app will use the P5 package's drawing capabilities for drawing since they work with socket. here's a link to a tut that helped get the drawing board connected to a socket.

japankid-code commented 3 years ago

websocket will require rooms with logic to make sure connected users are drawing in the right room. a room will get the 4 players in the game connected to the board.

since games are being played on websocket, there will be rooms that will limit who gets sent the drawing

so if there are 12 people playing games, 3 rooms would have 4 people in each game. all 12 would be connected to the socket but would only broadcast to the room they are in on the socket

so playing games doesn't happen in the routes or enter into the database at all, it happens on the server where the socket is

rooms are working with 4428bc3c1e8e6cfbd1c9ff8e3166c8a90ff0cb49