Giter Site home page Giter Site logo

Comments (5)

andersea avatar andersea commented on May 19, 2024 3

If you are using the same api key for both rest and websocket, there is a chance this can happen, since api calls can fall out of sync. Try using different keys for the rest interface and the websocket and see if that resolves the issue.

from api-connectors.

ko0f avatar ko0f commented on May 19, 2024

{"error":"Nonce is not increasing. This nonce: 1515130196494, last nonce: 1515128183690000"}

The two nonces have different format, one is in milliseconds and the other in microseconds. You should use the same format on both clients.

But as @andersea recommended, use different keys for RT and REST, they seem to have nonce conflicts. I couldn't figure out why, it looks like a server side issue.

from api-connectors.

ryanfox avatar ryanfox commented on May 19, 2024

Now the node-swagger and node-ws clients use the same nonce scheme. With a new API key, this shouldn't happen any more.

from api-connectors.

annugaurish avatar annugaurish commented on May 19, 2024

I have solved this problem by making changes in createSocket.js
Added following code in the createSocket function

wsClient.onreconnect = function() {
wsClient.url = makeEndpoint(options);

debug('Reconnecting to BitMEX at ', wsClient.url);

};

and in ReconnectionSocket.js added the following line in reconnect prototype
this.onreconnect();

this is to be added before this.open(this.url);

Changed API keys but it was not solving issue

from api-connectors.

QuentinFAIDIDE avatar QuentinFAIDIDE commented on May 19, 2024

Nonce is increased with each websocket request so you can send from time to time something with the send(msg, callback) method from the socket member of the _bitmexRealtimeApi2.default class (or even BitmexPlus class cause of inheritance) to fix this issue when the websocket client is not active. This was mentioned on another similar issue with the 'ping' message.
But pinging does not sounds like a good persistent fix, especially when Bitmex servers might already have lots of inactive opened sockets they will want to kick out one day, because if someone wants to use REST requests for prices instead of WS when they have no position opened and don't want to open one (I do), he can't disconnect the socket with the connector member functions, he has to access its member objects and hack around, it kind of breaks regular OOP encapsulation.
Bitfinex node API lets you request a reference to a websocket object from their main connector class, maybe this project needs to do the same and encapsulate the socket in another class so users can manipulate and start ws connections by themselves.

from api-connectors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.