saving state on server / socket changes