Skip to main content
The API is one connection plus messages over it. A topic is a string inside a Subscribe message, not a URL path — you always connect to wss://ws.etoro.com/ws and then subscribe.
Every message must be sent after the socket opens. A send() call made straight after new WebSocket(...) throws InvalidStateError, because the connection is still in the CONNECTING state — hence the onopen handler below.

Connect and subscribe

Unsubscribe

Close the connection