Socket.IO!
As for perhaps one of the most important bits… this is Socket.IO! I had to figure out how to get this working with Fastify first (thank you random GitHub commenter) since that’s my web framework of choice for the backend (for anything not going through Socket.IO), but here’s a basic implementation of it working!
what it do?
Socket.IO works similarly to (and if it’s available, on top of) WebSockets, where there’s a persistent connection with bi-directional communication between the client and the server. Socket.IO adds some extra fancy things on top of that, such as fallbacks when WebSockets aren’t available and rooms, and in general will make my life easier (lol).
This part is, of course, very important for getting a game handled by the backend to work! This will also allow us to do multiplayer. Discord gives you an instance ID for each activity that players are playing together, so I’ll use this to make the rooms, that way players in the same voice channel will end up in the same game!
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.