alpaca-ts icon indicating copy to clipboard operation
alpaca-ts copied to clipboard

fix error message type for WebSocket events

Open bennycode opened this issue 2 years ago • 0 comments

I noticed that the error object looks as follows:

{
  "code": 406,
  "msg": "connection limit exceeded",
  "T": "error"
}

My test code:

import {AlpacaStream, Message} from '@master-chief/alpaca';

const connection = new AlpacaStream({
  credentials: {
    key: options.apiKey,
    paper: options.usePaperTrading,
    secret: options.apiSecret,
  },
  source: 'iex',
  type: "market_data",
});

connection.once("error", (error: Message) => {
  console.log(error);
});

bennycode avatar Oct 03 '23 11:10 bennycode