implementation of socket.io message handling