I am trying to toast a message if I don't get a response from a WebSocket connection but I am not able to figure out how to do so
You can display the message after some timeout:
You can not display a message if the response never comes, because you can not know if the response will eventually come any time later.