Skip to content
This repository has been archived by the owner on May 1, 2018. It is now read-only.

Websockets unusable: 'Error 503 Negotiate Unknown' when using websockets.subscribe #154

Open
Marvosg opened this issue Mar 19, 2018 · 13 comments

Comments

@Marvosg
Copy link

Marvosg commented Mar 19, 2018

Using the latest version (1.0.0), when using websockets to subscribe to the orderbook, the Bittrex client prints Error 503. The code which causes this issue for me:

bittrex.websockets.client(function () {
    bittrex.websockets.subscribe(['BTC-ADA'],
        function (data) {
            if (data.M === 'updateExchangeState') {
                data.A.forEach((data_for) => {
                    // Do stuff
                });
            }
        });

The console prints:

Error Message:  Negotiate Unknown
Exception:  undefined
Error Data:  503

The expected result is a working subscription to the orderbook updates. Instead the connection will retry several times, failing every time with Error 503, with no successful result.

The endpoint is at https://bittrex.com/api/v1.1/public/getorderbook?market=BTC-ADA&type=both and I can access it from the same machine with Firefox without a problem. As I understand this issue has to do with Bittrex enabling Cloudflare protection on the public api endpoints, but also that this issue is supposed to be fixed in this repository as per Issue #1 - Websockets and Cloudflare.

It seems to me that the issue is not solved. Or is there an accepted workaround that is not documented in the README? Error 503 has prevented me from using Bittrex websockets for the last two hours, during the main business hours of the exchange, so this issue is critical bug for my use case.

@mountainmoon
Copy link

I also met this problem recently. But sometimes it works normally.

@amirdauti
Copy link

Im having the same issue as well, anyone have a solution?

@aloysius-pgast
Copy link

On my side I have some cases where connection it fails for =~ 30 minutes (Bittrex answering with error 503 Service Temporarily Unavailable) but in the end I always manage to reconnect

@amirdauti
Copy link

are you manually reconnecting or is the socket connecting on its own? mine runs as a service so i have no way of verifying that it will eventually connect.

@aloysius-pgast
Copy link

Automatic reconnection

@aloysius-pgast
Copy link

Take a look at #153 (comment). Adding extra headers to CloudScraper helped improve connection delay on my side

@Amindv1
Copy link

Amindv1 commented Mar 30, 2018

I'm getting the same error:

Error Message: Negotiate Unknown
Exception: undefined
Error Data: 503

It attempts to force a reconnect a couple times, but it ends up connecting multiple times. How can I avoid getting this error? I checked and the cookie and user agent are both included in the header.

Also, it ends up throwing me really old Nounces after being connected for a couple days, so I'm forced to reconnect. How can I avoid this?

@mightymouse2045
Copy link

wait for beta api to be incorporated

@Jonathanx5
Copy link

Jonathanx5 commented Apr 2, 2018

You talk about a beta api, but do we have a stable approach concerning this web socket issue ?
How can we build a up to date and synchronised order book with web socket ?
For now, I get data after some seconds, and then, it seems I have multiple connections (I receive the same data/nonce many times)
If you have any idea, I would be very interrested .
PS: I add a screenshot of what I receive, I think I receive data from many websocket in a not synchronized way (I receive nounces that do not follow each other, 434035, 435271 then 434036)
capture d ecran 2018-04-02 a 12 33 36

My code :

capture d ecran 2018-04-02 a 12 41 43

@aloysius-pgast
Copy link

@Jonathanx5 : a few months ago I also had the same problem with signalr-client not closing previous connections when a network error / disconnection occurred. The result was my client receiving multiple updates like you described. I ended up working on an alternate implementation for the WS part of Bittrex API (while keeping this lib for REST API). It's tailored for my own needs so it might not suit yours though

@gRittyKitty
Copy link

I had this problem. After I installed all of the dependencies, it worked for me. Doubting that is the problem for anyone here, but figured it was worth mentioning.

@geekguy
Copy link

geekguy commented Apr 20, 2018

Facing this problem in 0.8.3.

@aloysius-pgast
Copy link

You should change the headers passed to Cloud Scraper. Check #153 (comment). If you want to try master, a new option cloudscraper_headers has been added just for that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants