I am using the websocket-client and wanted to know how can I use ping/pong to check the connection is still open ?
I am using the short lived connection option but still want to check if the websocket has not disconnected in the meantime. Is it as simple as ws.ping() ? Will there be an exception of the sort?
import socket
from websocket import create_connection
ws = create_connection("ws://localhost/", # Dummy URL
socket = my_socket,
sockopt=((socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),))```