Created
September 22, 2012 22:49
-
-
Save aashay/3768121 to your computer and use it in GitHub Desktop.
Revisions
-
aashay revised this gist
Sep 22, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ /* 1. node server.js */ var io = require('socket.io').listen(1234); io.configure(function () { io.set('transports', ['xhr-polling']); }); io.set('authorization', function(handshakeData, ack) { -
aashay revised this gist
Sep 22, 2012 . No changes.There are no files selected for viewing
-
aashay revised this gist
Sep 22, 2012 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
aashay created this gist
Sep 22, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ /* 2. node client.js */ var io = require('socket.io-client'); var socket = io.connect('http://localhost:1234'); socket.on("error", function(err){ console.log(err); }); socket.on('connect', function(message){ console.log("Connection established!"); //You'll never see this. socket.emit("news", "hi"); }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ // This is the error you'll see after several seconds. timers.js:103 if (!process.listeners('uncaughtException').length) throw e; ^ TypeError: Cannot call method 'onClose' of null at Object._onTimeout (/private/tmp/sockettest/node_modules/socket.io-client/lib/socket.js:281:22) at Timer.list.ontimeout (timers.js:101:19) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ /* 1. node server.js */ var io = require('socket.io').listen(1234); io.configure(function () { io.set('transports', ['xhr-polling']); }); io.set('authorization', function(handshakeData, ack) { return ack(null, true); }); io.sockets.on('connection', function (socket) { console.log("Someone connected!"); socket.on("news", function(data){ console.log(data); }); });