var socket = io();
function sendMsg() {
var $msg = $("#message");
var $chat = $("#chat");
socket.emit('sendMessage', $msg.val());
socket.on('backMsg', function(data){
$chat.append('<div class="well">'+data+'</div>');
});
}
socket.on('sendMessage', function(data){
io.sockets.emit('backMsg', data);
});