moved socket.io code to seaparate file