Remove the Player from the world if the socket gets disconnected, you can also check in the Update method if the socket is connected, if not you know that the the player should no longer exist.
The pet should disappear if the Owner (Player) is no longer in the world, you can achieve that if you simply check if the owner is still in the world, once you get the player to disappear the pet should also be gone.
Pet code to check if the player exists (you might need to change some of the names)