June 2015
Beginner
354 pages
8h 23m
English
Carry out the following steps:
game.js file and add two constants at the beginning of the file, as follows:// Constants var LINE_SEGMENT = 0; var CHAT_MESSAGE = 1;
Room.prototype.addUser method, add the following code at the beginning of the method:this.users.push(user);
var room = this;
// tell others that someone joins the room
var data = {
dataType: CHAT_MESSAGE,
sender: "Server",
message: "Welcome " + user.id
+ " joining the party. Total connection: " + this.users.length
};
room.sendAll(JSON.stringify(data));Read now
Unlock full access