var chat var RoomView = View.extend({ events: { }, initialize: function(name){ this.name = name chat = this.chatView = new ChatView () this.userlist = new UserlistView () app.socket = ws.connect(name) app.socket.emit("join", { nick: user.username }) app.socket.on("joined", function(msgs){ msgs && msgs.forEach(chat.add) }) app.socket.on("messages", function(msgs){ msgs && msgs.forEach(chat.add) }) app.socket.on("message", function(msg){ chat.add(msg) }) } })