diff --git a/lib/rooms.js b/lib/rooms.js index 8f67f1b..be2bb0d 100644 --- a/lib/rooms.js +++ b/lib/rooms.js @@ -144,7 +144,7 @@ exports.add_to_room_and_announce = function (client, room, msg) { for (var i = 0; i < clients.length; i++) { if (clients[i].id != client.id) - clients[i].send(msg); + clients[i].json.send(msg); } }); } @@ -171,7 +171,7 @@ exports.remove_from_all_rooms_and_announce = function (client, msg) { for (var i = 0; i < clients.length; i++) { if (clients[i].id != client.id) - clients[i].send(msg); + clients[i].json.send(msg); } }); } @@ -192,7 +192,7 @@ exports.broadcast = function(msg) { exports.broadcast_room = function(room, msg) { var clients = exports.room_clients(room); for (var i = 0; i < clients.length; i++) - clients[i].send(msg); + clients[i].json.send(msg); }; // Broadcast message to all the other clients that are in rooms with this client @@ -224,6 +224,6 @@ exports.broadcast_to_roommates = function (client, msg) { for (var i = 0; i < roommates.length; i++) { console.log(' - ' + roommates[i].id); - roommates[i].send(msg); + roommates[i].json.send(msg); } }