Created
November 1, 2011 08:19
-
-
Save josephg/1330141 to your computer and use it in GitHub Desktop.
echo server & client
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
connect = -> | |
clientio = require 'socket.io-client' | |
client = clientio.connect 'http://localhost:8999' | |
client.on 'connect', -> | |
console.warn 'Connected' | |
setInterval -> | |
console.time 'message' | |
client.send 'hi' | |
, 1000 | |
client.on 'message', (msg) -> | |
console.timeEnd 'message' | |
io = require('socket.io').listen(8999, connect) | |
io.sockets.on 'connection', (socket) -> | |
socket.on 'message', (msg) -> | |
socket.send msg | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment