June 2015
Beginner
354 pages
8h 23m
English
servergame.js. Add the following function to the file that handles user messages:Room.prototype.handleOnUserMessage = function(user) {
var room = this;
user.socket.on("message", function(message){
console.log("Receive message from " + user.id + ": " + message);
});
};Room.prototype.addUser method that calls our newly created function:this.handleOnUserMessage(user);
client folder.index.html file and add the following markup in the body section. This provides inputs for the user to type and send messages to the server:<input type="text" id="chat-input" autocomplete="off"> <input type="button" ...
Read now
Unlock full access