Moved listeners to where the socket is being instantiated.