adds listeners for socket events