Issue with how multiple websockets connections (and potentially sessions) are handled
See original GitHub issueI initially connected to Websockets in one project and it worked fine. I wanted to connect from another project using the same credentials, however authentication does not work.
Now I understand connections are limited to a single client, but the connection is not working from my second project even after calling client.disconnect() from my first project. Using onStateChange prints the following to the console:
State changed to authenticating
State changed to disconnected
Using the websockets example code from Polygon worked fine and resulted in a connection, which successfully authenticates, and then disconnects both the current connection and first project’s connection. The good thing about this is that it prints a helpful error message to the console:
Status Update: Maximum number of connections exceeded
I can then reconnect again with no problems
Sidenote: The Polygon direct websocket connection still disconnects even when you set usePolygon to false on the Alpaca authentication object.
I believe there is an issue with how multiple connections are handled in this repo. It prevents connection from another codebase (even after the first one is disconnected), and does not provide any helpful error message
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
@kevinsherman please install the udpated version and try again install directly from github
try the example code https://github.com/alpacahq/alpaca-trade-api-js/blob/master/examples/long-short.js