Skip to content

Instantly share code, notes, and snippets.

@Srushtika
Created June 9, 2020 21:04
Show Gist options
  • Save Srushtika/418952ac41bf19d17ab3ec37eb52399e to your computer and use it in GitHub Desktop.
Save Srushtika/418952ac41bf19d17ab3ec37eb52399e to your computer and use it in GitHub Desktop.
Code snippet 24 - For multiplayer space invaders article
const realtime = Ably.Realtime({
authUrl: BASE_SERVER_URL + "/auth",
});
realtime.connection.once("connected", () => {
myClientId = realtime.auth.clientId;
gameRoom = realtime.channels.get("game-room");
deadPlayerCh = realtime.channels.get("dead-player");
myChannel = realtime.channels.get("clientChannel-" + myClientId);
gameRoom.presence.enter(myNickname);
game = new Phaser.Game(config);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment