Connecting to the websocket - 1006 error

I’m trying to connect to the websocket to get access to order updates. I’m using the faye-websocket-ruby gem and the code seems pretty straightforward. When I run the code I immediately get a “close, 1006” message.

I’ve tried sending the authentication JSON after the connection opens, but I don’t think it’s even getting past ws =‘’)

Do I have the correct endpoint? Anyone else struggling with the same thing?

  def listen {
          ws ='')
      ws.on :open do |event|
        p [:open]

      ws.on :message do |event|
        p [:message,]

      ws.on :close do |event|
        p [:close, event.code, event.reason]
        ws = nil

Disregard - I figured it out.

Had the wrong endpoint, and for anyone else using Ruby, you need to use the MessagePack gem to unpack the messages received from the stream.

Hi Chris!

I’m impressed that this is the only post regarding this problem.

I’m trying to deploy my bot on the cloud (PA and Heroku), but I’m running into the same problem. After running for a couple of hours the web socket disconnects.

Can you share more about your setup?