I was trying to implement a multiuser chat (group chat) with socket on python. 
It basically works like this: Each messages that a user send is received by the server and the server sends it back to the rest of the users.
The problem is that if the server close the program, it crashes for everyone else. 
So, how can you handle the departure of the server, should you change the server somehow, or there is other way around it?
Thank you
could you make your server log for heartbeats? and also post heartbeats to the clients on the socket?
if so, have a monitor check for the server heartbeats and restart the server application if the heartbeats exceed the threshold value. 
also, check for heartbeats on the client and reestablish connection when you did not hear a heartbeat.
Creating Multi-user chat with sockets on python, how to handle the departure of the server?