Created
July 7, 2011 17:57
-
-
Save ericz/1070109 to your computer and use it in GitHub Desktop.
This file contains 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 characters
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
var socket = io.connect(); | |
socket.on('a', function(){ | |
//alert(1); | |
}); | |
socket.on('b', function (data) { | |
alert(1); | |
}); | |
</script> |
This file contains 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 characters
[36minfo -[39m socket.io started | |
[90mdebug -[39m served static /socket.io.js | |
[90mdebug -[39m client authorized | |
[36minfo -[39m handshake authorized 21680558507223987 | |
[90mdebug -[39m setting request GET /socket.io/1/jsonp-polling/21680558507223987/?t=1310062023833&i=0 | |
[90mdebug -[39m setting poll timeout | |
[90mdebug -[39m client authorized for | |
[90mdebug -[39m clearing poll timeout | |
[90mdebug -[39m jsonppolling writing io.j[0]("1::"); | |
[90mdebug -[39m set close timeout for client 21680558507223987 | |
[90mdebug -[39m setting request GET /socket.io/1/jsonp-polling/21680558507223987/?t=1310062023839&i=0 | |
[90mdebug -[39m setting poll timeout | |
[90mdebug -[39m clearing poll timeout | |
[90mdebug -[39m jsonppolling writing io.j[0]("�16�5:::{\"name\":\"a\"}�16�5:::{\"name\":\"b\"}"); | |
[90mdebug -[39m set close timeout for client 21680558507223987 | |
[90mdebug -[39m discarding transport | |
[90mdebug -[39m cleared close timeout for client 21680558507223987 | |
[90mdebug -[39m setting request GET /socket.io/1/jsonp-polling/21680558507223987/?t=1310062023842&i=0 | |
[90mdebug -[39m setting poll timeout | |
[90mdebug -[39m discarding transport | |
[90mdebug -[39m cleared close timeout for client 21680558507223987 |
This file contains 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 characters
var static = require('node-static'); | |
var file = new(static.Server)('.'); | |
var app = require('http').createServer(function (request, response) { request.addListener('end', function () { file.serve(request, response); }); }); | |
var io = require('socket.io').listen(app); | |
io.configure(function () { | |
io.set('transports', ['jsonp-polling']); | |
}); | |
app.listen(80); | |
io.sockets.on('connection', function (socket) { | |
socket.emit('a'); | |
socket.emit('b'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment