Skip to content

Instantly share code, notes, and snippets.

@Srushtika
Last active June 9, 2020 13:53
Show Gist options
  • Save Srushtika/8c8b8f26016372647b30f90266276845 to your computer and use it in GitHub Desktop.
Save Srushtika/8c8b8f26016372647b30f90266276845 to your computer and use it in GitHub Desktop.
Code snippet 9 - For multiplayer space invaders article
realtime.connection.once("connected", () => {
gameRoom = realtime.channels.get("game-room");
deadPlayerCh = realtime.channels.get("dead-player");
gameRoom.presence.subscribe("enter", (player) => {});
gameRoom.presence.subscribe("leave", (player) => {});
deadPlayerCh.subscribe("dead-notif", (msg) => {});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment