Connecting the clients
Our approach has been bottom-up rather than top-down: first we built the game, then we built the message handlers, and now it's time to bring in the client but all of the pieces are coming together. Next, we want to connect two players so that two people can play XMPPong! First, we need those two players to have unique JIDs, so we need to let each player log into the game.
First, we need to create some accounts so that multiple people can log into the game. Let's create accounts for two players, Marty and Jennifer:
sudo prosodyctl adduser marty@localhost sudo prosodyctl adduser jennifer@localhost
Tip
For simplicity, I made Marty's password m
and Jennifer's password j
.
Next, we need to let Marty and Jennifer log into their respective Pong clients. We'll need to extend index.ejs
with a couple of input fields to let our players enter their username and password, and we'll need to extend pong.js
to accept the new username and password combination and use that to log into...