socket.js modified by Liang Gong to handle multiple connections.