Skip to content

Instantly share code, notes, and snippets.

@matsumotius
Created October 21, 2011 16:18
Show Gist options
  • Save matsumotius/1304243 to your computer and use it in GitHub Desktop.
Save matsumotius/1304243 to your computer and use it in GitHub Desktop.
client
$(function(){
var socket = io.connect('http://localhost/');
socket.on('hello', function(message){
$('body').append('<p>'+message+'</p>');
});
$('body').append('<button id="send">全員に送る</button>');
$('#send').click(function(e){
socket.emit('message', 'hello!! '+new Date().toLocaleString());
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment