Add server disconnection code to the frontend