you can use the following code:
//broadcasts to all clients connected
io.sockets.emit('function', {foo:bar});
//broadcasts to all clients connected, except the sender
io.sockets.on('connection', function (socket) {
socket.on('message', function(data) {
socket.broadcast.emit('function', {foo:bar});
}
}