title: web-socket client will not connect to an API
body: <p>After searching the web for hours and asking the same question on Reddit with no success, I have decided to sign up to Stack Overflow and ask the question here.</p>
  <p>I am currently following a tutorial to learn more about APIs. This specific tutorial is working with the Binance API to try to collect data about the BTC price in USD once every minute. To do this I have imported WebSocket-client to keep a steady connection and collect new data points once every minute, however whenever I run my code nothing happens. The console prints &quot;Process finished with exit code 0&quot;, instead of actually connecting to the server and collecting data.</p>
  <p>Here's my code:</p>
  <pre><code>import websocket
  
  SOCKET = &quot;wss://stream.binance.com:9443/ws/btcusdt@kline_1m&quot;
  
  def on_open(ws):
      print('connection: successful')
  
  def on_close(ws):
      print('connection: lost')
  
  def on_message(ws, message):
      print('message')
  
  ws = websocket.WebSocketApp(SOCKET, on_open=on_open, on_close=on_close, on_message=on_message)
  ws.run_forever()
  </code></pre>
  <p>At first, I thought I had the wrong WebSocket library installed (instead of WebSocket-client I thought I was using. the regular WebSocket library) however, I did not. Then I thought that maybe there was something wrong with PyCharm, so I ran the code in Visual Studio Code, Sublime Text, the Terminal, and Jupyter notebook, but none of them worked either.</p>
  <p>Is there anything wrong with my code? I've attempted numerous edits but none of them have worked so far.</p>
  <p>Binance API docs: <a href="https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md" rel="nofollow noreferrer">https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md</a></p>
  <p>The tutorial I am following: <a href="https://youtu.be/GdlFhF6gjKo?t=1112" rel="nofollow noreferrer">https://youtu.be/GdlFhF6gjKo?t=1112</a> (go to around 18:32 to see his code).</p>
  <p>ps. I am a new programmer and just finished my first project (a* pathfinding algorithm) so don't be too harsh :).</p>