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 characters
cclough:rsj christian [master] $ls -a -R -l | |
total 56 | |
drwxr-xr-x 9 christian staff 306 17 Sep 11:33 . | |
drwxr-xr-x 11 christian staff 374 17 Sep 11:55 .. | |
-rw-r--r-- 1 christian staff 6148 17 Sep 11:25 .DS_Store | |
drwxr-xr-x 14 christian staff 476 17 Sep 10:10 .git | |
-rw-r--r-- 1 christian staff 12 16 Sep 14:41 .gitignore | |
-rw-r--r-- 1 christian staff 21 16 Sep 14:05 Procfile | |
-rw-r--r-- 1 christian staff 1261 17 Sep 10:40 index.html | |
-rw-r--r--@ 1 christian staff 261 17 Sep 11:57 package.json |
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 characters
<script src="/socket.io/socket.io.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | |
<script> | |
var socket = io.connect(); | |
// on connection to server, ask for user's name with an anonymous callback | |
socket.on('connect', function(){ | |
// call the server-side function 'adduser' and send one parameter (value of prompt) | |
socket.emit('adduser', prompt("What's your name?")); | |
}); |
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 characters
var app = require('express').createServer() | |
var io = require('socket.io').listen(app); | |
app.listen(8080); | |
// routing | |
app.get('/', function (req, res) { | |
res.sendfile(__dirname + '/index.html'); | |
}); |
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 characters
{ | |
"name": "roulette_server", | |
"description": "example chat application with socket.io", | |
"version": "0.0.1-1", | |
"dependencies": { | |
"express": "2.4.6", | |
"socket.io": "0.8.4" | |
}, | |
"subdomain": "cclough.roulette_server", | |
"scripts": { |