So, if I understand you correctly, you want the client to become the server if the original server goes offline?
You could write a bash script on the client to do this I suspect. The script would ping the server and, if the ping times out, execute the commands you need to change from client to server. Something like:
replacing "do stuff" with whatever procedures you want the script to execute if it can no longer connect.
while [ "$(ping -c5 server_ip | grep '\ 0% packet loss')" != "" ]