Websocket inconsistencies

The return message type for wss://paper-api.alpaca.markets/stream is binary.

The return message type for wss://data.alpaca.markets/stream is plaintext (or String in Java).

I’m not sure if this inconsistency is intended, but it made for a hell of a day of troubleshooting. If you’re using the Java SDK from Peterson and you wish to connect to the market data stream, you’ll want to have a look at https://github.com/Petersoj/alpaca-java/pull/75.

Ping me with questions, as I am now WAY too familiar with this code.

you can convert the binary date to text as follows:

String.fromCharCode.apply(null, new Uint8Array(raw))