client-side socket.io code