Moving the socket connection to a global