Attempting to connect to the data websocket with the following code just endlessly prints out “Attempting Polygon websocket reconnection…”
const dataWS = alpaca.data_ws;
dataWS.connect();
dataWS.onConnect(function () {
dataWS.subscribe([‘Q.SPY’]);
});
dataWS.onDisconnect(() => {
console.log(“Disconnected”)
})
dataWS.onStockQuotes(function(subject, data) {
console.log(Stock quotes: ${subject}, bid: ${data.bidprice}, ask: ${data.askprice}
)
});