windhamdavid 10 years ago
parent
commit
363bc26662
1 changed files with 24 additions and 27 deletions
  1. 24 27
      server.js

+ 24 - 27
server.js

@@ -6,40 +6,37 @@ var port = process.env.PORT || 8881;
 server.listen(port);
 
 app.get('/', function(req, res) {
-  res.sendFile(__dirname + '/index.html');
+	res.sendFile(__dirname + '/index.html');
 });
 app.get('/style.css', function(req, res) {
-  res.sendFile(__dirname + '/style.css');
+	res.sendFile(__dirname + '/style.css');
 });
 app.get('/script.js', function(req, res) {
-  res.sendFile(__dirname + '/script.js');
+ 	res.sendFile(__dirname + '/script.js');
 });
 app.get('/webrtc.io.js', function(req, res) {
-  res.sendFile(__dirname + '/webrtc.io.js');
+	res.sendFile(__dirname + '/webrtc.io.js');
 });
 
 webRTC.rtc.on('chat_msg', function(data, socket) {
-  var roomList = webRTC.rtc.rooms[data.room] || [];
-
-  for (var i = 0; i < roomList.length; i++) {
-    var socketId = roomList[i];
-
-    if (socketId !== socket.id) {
-      var soc = webRTC.rtc.getSocket(socketId);
-
-      if (soc) {
-        soc.send(JSON.stringify({
-          "eventName": "receive_chat_msg",
-          "data": {
-            "messages": data.messages,
-            "color": data.color
-          }
-        }), function(error) {
-          if (error) {
-            console.log(error);
-          }
-        });
-      }
-    }
-  }
+var roomList = webRTC.rtc.rooms[data.room] || [];
+	for (var i = 0; i < roomList.length; i++) {
+		var socketId = roomList[i];
+		if (socketId !== socket.id) {
+			var soc = webRTC.rtc.getSocket(socketId);
+			if (soc) {
+				soc.send(JSON.stringify({
+				"eventName": "receive_chat_msg",
+				"data": {
+				"messages": data.messages,
+				"color": data.color
+				}
+			}), function(error) {
+				if (error) {
+				console.log(error);
+				}
+			});
+		}
+	}
+}
 });