move connect io stuff to socket.lua