Implemented socket.io functionality