Skip to content

Instantly share code, notes, and snippets.

@jcoglan
Created May 31, 2014 15:52
Show Gist options
  • Save jcoglan/9179f09c2f7bc23e5bfb to your computer and use it in GitHub Desktop.
Save jcoglan/9179f09c2f7bc23e5bfb to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Socket.io</title>
<script src="http://localhost:9000/socket.io/socket.io.js"></script>
</head>
<body>
<h1>Socket.io</h1>
<script>
var socket = io('http://localhost:9000');
</script>
</body>
</html>
var socket = require('socket.io'),
http = require('http');
var server = http.createServer(),
io = socket(server);
io.on('connection', function(connection) {
console.log('[OPEN]');
connection.on('disconnect', function() {
console.log('[END]');
});
});
server.listen(9000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment