Minor changes
authorRaphael Velt <raph.velt@gmail.com>
Tue, 25 Oct 2011 09:36:21 +0200
changeset 334 b7f05d66b620
parent 333 4389fd4ae58f
child 335 5f83c21dee69
Minor changes
tweetcast/nodejs/client/index.html
tweetcast/nodejs/client/js/script.js
tweetcast/nodejs/node-direct.js
--- a/tweetcast/nodejs/client/index.html	Tue Oct 25 09:20:07 2011 +0200
+++ b/tweetcast/nodejs/client/index.html	Tue Oct 25 09:36:21 2011 +0200
@@ -4,11 +4,7 @@
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>Polemic Tweet “TweetCast”</title>
   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
-  <script type="text/javascript">
-    S_IO_HOST = document.location.hostname;
-    S_IO_PORT = 8000;
-    document.write('<script type="text/javascript" src="http://' + S_IO_HOST + ':' + S_IO_PORT + '/socket.io/socket.io.js"><' + '/script>');
-  </script>
+  <script type="text/javascript" src="/socket.io/socket.io.js"></script>
   <script type="text/javascript" src="js/Raphael-min.js"></script>
   <script type="text/javascript" src="js/jquery.mousewheel.min.js"></script>
   <script type="text/javascript" src="js/script.js"></script>
--- a/tweetcast/nodejs/client/js/script.js	Tue Oct 25 09:20:07 2011 +0200
+++ b/tweetcast/nodejs/client/js/script.js	Tue Oct 25 09:36:21 2011 +0200
@@ -273,7 +273,7 @@
 $(document).ready(function() {
     tlPaper = Raphael("timeline", 220, 600);
     twPaper = Raphael("timewindow", 220, 600);
-    socket = io.connect('http://' + S_IO_HOST + ':' + S_IO_PORT );
+    socket = io.connect('http://' + document.location.hostname );
     socket.on('tweetSummary', function (data) {
         if (tweetData.tweetcount != data.tweetcount) {
             tweetData.tweetcount = data.tweetcount;
--- a/tweetcast/nodejs/node-direct.js	Tue Oct 25 09:20:07 2011 +0200
+++ b/tweetcast/nodejs/node-direct.js	Tue Oct 25 09:36:21 2011 +0200
@@ -167,9 +167,11 @@
 }
 
 function httpHandler(req, res) {
+    console.log("HTTP Request for URL "+req.url);
     var url = req.url + ( req.url[req.url.length - 1] == "/" ? "index.html" : "" );
     fs.readFile(__dirname + "/client" + url, function(err, data) {
         if (err) {
+            console.log("Error 404");
             res.writeHead(404);
             return res.end('File not found');
         }