AuroraDAO / idex-api-docs

IDEX API documentation (work in progress)
81 stars 27 forks source link

Session ID Mismatch #40

Closed bugduino closed 6 years ago

bugduino commented 6 years ago

Hi, I'm trying to establish a reliable connection to the v1 websocket api, I'm able to connect and perform the handshake correctly, I get a response like

{"sid":"XXXXXXX","result":"success","format":"json","method":"handshake","payload":{}}

after that one I start receiving the correct data, but after a couple o seconds the server closes the socket connection with reason: 412, Session ID Mismatch.

any idea why? Should I use the sid parameter received after the handshake request? If yes how?

Thank you

bradennapier commented 6 years ago

You must include the sid with every request once you receive it. You should also be ignoring any request that doesn't have the matching sid property.

bugduino commented 6 years ago

Whet do you mean with every request? I'm connecting to the socket once, sending the handshake and then I'm simply waiting for events with

idexService.socket.on('notifyOrderInserted', market => { doStuff() });

do I have to make other requests to keep the connection alive?