title: Message type websocket gdax (coinbase)
body: <p>I am interested in getting real-time data using the Gdax (Coinbase) WebSocket. I'm a total noob so I am inspecting the example Gdax posted in their documentation:</p>
  
  <pre><code>import gdax, time
  class myWebsocketClient(gdax.WebsocketClient):
      def on_open(self):
          self.url = "wss://ws-feed.gdax.com/"
          self.products = ["LTC-USD"]
          self.message_count = 0
          print("Lets count the messages!")
      def on_message(self, msg):
          self.message_count += 1
          if 'price' in msg and 'type' in msg:
              print ("Message type:", msg["type"], 
                     "\t@ {}.3f".format(float(msg["price"])))
      def on_close(self):
          print("-- Goodbye! --")
  
  wsClient = myWebsocketClient()
  wsClient.start()
  print(wsClient.url, wsClient.products)
  while (wsClient.message_count &lt; 500):
      print ("\nmessage_count =", "{} \n".format(wsClient.message_count))
      time.sleep(1)
  wsClient.close()
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>...
  Message type: received  @ 50.78.3f
  Message type: open      @ 50.78.3f
  Message type: done      @ 51.56.3f
  Message type: received  @ 51.59.3f
  Message type: open      @ 51.59.3f
  Message type: done      @ 51.51.3f
  Message type: done      @ 51.17.3f
  Message type: done      @ 51.66.3f
  
  Kernel died, restarting
  </code></pre>
  
  <p>I have a few question regarding this code and output:</p>
  
  <ol>
  <li>What does the message type (received, open, done, match) mean, which type is used for doing calculations, and why are some types skipped?</li>
  <li>Why does running the code always ends in 'Kernel died, restarting'?</li>
  <li>The documentation states that this code is for illustration only. Does that mean that this isn't a proper way of getting real-time data in order to do stuff with it?</li>
  </ol>
  
  <p>If you know some good articles or books that can teach a noob how to work with WebSockets, I would love to hear about them!</p>