I can:
- get the listenKey via WebSocket api via userDataStream.start method and then use userDataStream.subscribe method to subscribe;
- get the listenKey via rest api and then create a socket to wss://stream.binance.com:9443/ws and get update.
What’s the difference between this 2 methods? Are they equivalent?
Hi @gputignano,
The methods are equivalent, the only difference is the preferred protocol (REST or WS) to use. In the end of the day both of them can manage a user data stream.
1 Like
Thanks @dimitrisn. I saw tha using Web Socket Stream I don’t need listenKey. I need listenKey only if I connect to User Data Stream. Do you confirm?
That’s correct yeah, User Data Streams provide updates like balanceUpdate
on demand where WebSocket Streams provide updates on the selected streams.
listenKey
is needed only for User Data Streams and not for the rest of the streams when creating a websocket.