slight socket.io library refarctoring