move socket.io functionality into own module