title: Python - How to send heartbeat using websocket-client?
body: <p>The server requires the client to send a heartbeat every 30 seconds to keep the connection alive. How can I achieve this using python websocket-client library?</p>
  <pre><code>import websocket
  def on_open(ws):
       pass
  def on_close(ws):
       pass
  def on_message(ws, message):
       pass
  
  socket = &quot;wss:// the rest of the url&quot;
  ws = websocket.WebSocketApp(socket, on_open=on_open,on_message=on_message)
  ws.run_forever()
  </code></pre>
  <p>No code runs after ws.run_forever(). How can I send messages ? Thank you</p>