Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bugfix: replaced a rogue reference to an old closure 'socket' with 't…

…his'
  • Loading branch information...
commit 182512548e0ac79d854fffd9ec12cdc4b9a0d1ec 1 parent 5d00f76
Montana Rowe authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 chat_app/server.js
View
8 chat_app/server.js
@@ -80,22 +80,22 @@ MySocket.prototype.events = [
MySocket.prototype.listenOn = function listenOn(name){
this.socket.on(name, this[name]);
}
-MySocket.prototype.setname = function setname(name,fn){
+MySocket.prototype.setname = function setname(name, fn){
if(getUser(name)){
fn(true);
} else {
fn(false);
setUser(socket.name = name);
this.broadcast.emit("announcement", name + " connected.");
- io.sockets.emit("users",users);
+ io.sockets.emit("users", users);
}
- this.emit("nameset",name);
+ this.emit("nameset", name);
}
MySocket.prototype.getUsers = function getUsers(){
this.emit("users", users);
}
MySocket.prototype.message = function message(message){
- io.sockets.emit("message", socket.name + ": " + message);
+ io.sockets.emit("message", this.name + ": " + message);
}
MySocket.prototype.disconnect = function disconnect(){
if(this.name)
Please sign in to comment.
Something went wrong with that request. Please try again.