Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | /** * This class handles real-time WebSocket communication for frontend and backend interactions */ class SocketHandler{ /** * Handles all processes related to users joining a session * * @param {Socket} socket The socket information linked to the game session * @param {string} roomId The room ID number linked to the game session * @throws An error if the user could not join the game session */ onPlayerJoin(socket, roomId){ try { } catch (err){ console.log("User could not join game session"); } } /** * Handles all processes related to users leaving a session * * @param {Socket} socket The socket information linked to the game session * @param {string} roomId The room ID number linked to the game session * @throws An error if the user could not leave the game session */ onPlayerLeave(socket, roomId){ try { } catch (err){ console.log("User could not leave game session"); } } /** * Handles all processes related to the drawing on the canvas * * @param {Socket} socket The socket information linked to the game session * @param {DrawingData} data The drawing data specified to be updated to the game server * @throws An error if the drawing data was unable to be updated */ onDrawingData(socket, data){ try { } catch (err){ console.log("Drawing data unable to be updated"); } } /** * Handles all processes related to processing guesses in the form of chat messages * * @param {Socket} socket The socket information linked to the game session * @param {ChatMessage} message The message data specified to be updated to the game server * @throws An error if the message data was unable to be updated */ onChatMessage(socket, message){ try { } catch (err){ console.log("Message data unable to be updated"); } } /** * Handles all processes related to starting a new round * * @param {Socket} socket The socket information linked to the game session * @param {GameRoom} room The GameRoom object linked to the game session * @throws An error if the round was unable to start */ onRoundStart(socket, room){ try { } catch (err){ console.log("Round was unable to start"); } } /** * Handles all processes related to ending a round * * @param {Server} io The socket.io server information linked to the game session * @param {GameRoom} room The GameRoom object linked to the game session * @throws An error if the round was unable to end */ onRoundEnd(io, room){ try { } catch (err){ console.log("Round was unable to start"); } } /** * Handles all processes related to updating game data to all players in the game session * * @param {Socket} socket The socket information linked to the game session * @param {GameRoom} roomID The room ID number linked to the game session * @param {string} event The event string used to identify what is being broadcast to the game session * @param {any} data The data broadcast to the game session * @throws An error if the data was unable to be broadcast to the game session */ broadcastToRoom(socket, roomID, event, data){ try { } catch (err){ console.log("Data was unable to be broadcast to the game session"); } } } |