rewrite in socket.io