Created
November 18, 2019 08:44
-
-
Save tsh-code/3f4a4efcd8bea9cb9100c597b082f1ec to your computer and use it in GitHub Desktop.
Typical WebSocket handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
io.on("connection", socket => { | |
socket.on("message", message => { | |
if (message.method === "JOIN_GAME") { | |
// DO SOMETHING | |
} | |
if (message.method === "LEAVE_GAME") { | |
// DO SOMETHING ELSE | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment