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 = Faye::WebSocket::Client.new(‘https://paper-api.alpaca.markets/stream’)

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

  def listen
        EM.run {
          ws = Faye::WebSocket::Client.new('https://paper-api.alpaca.markets/stream')
      
      ws.on :open do |event|
        p [:open]
      end

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

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

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.