Skip to content

Instantly share code, notes, and snippets.

@youweit youweit/gist:6228826
Created Aug 14, 2013

What would you like to do?
<!doctype html>
<script src='//'></script>
<script src="//localhost:3000/" type="text/javascript"></script>
var socket = io.connect('//localhost:3000');
socket.on('welcome', function(data) {
$('#messages').append('<li>' + data.message + '</li>');
socket.emit('i am client', {data: 'foo!'});
socket.on('time', function(data) {
$('#messages').append('<a>' + data.time + '</a>');
socket.on('person', function(data) {
$('#messages').append('<a>' + data.person +" "+ data.x +" "+data.y +" "+data.z + '</a>');
socket.on('error', function() { console.error(arguments) });
socket.on('message', function() { console.log(arguments) });
<a id='messages'></a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.