aloysius-pgast / bittrex-signalr-client

Node.js implementation of SignalR protocol tailored for Bittrex exchange
39 stars 14 forks source link

Getting 400: Bad request connection error #2

Closed AndrewJDR closed 6 years ago

AndrewJDR commented 6 years ago

Hello,

I tried the subscribe_to_markets.js example, but it returns a 400 Bad request error from bittrex.

To repro:

AndrewJDR commented 6 years ago

This fixed it for me:

diff --git a/lib/connection.js b/lib/connection.js
index 0c8b306..8791704 100644
--- a/lib/connection.js
+++ b/lib/connection.js
@@ -622,7 +622,7 @@ _start(connection, retryCount)
              url:util.format('%s/start', BASE_HTTPS_URL),
              qs:{
                  clientProtocol:CLIENT_PROTOCOL_VERSION,
-                 transport:'serverSentEvents',
+                 transport:'webSockets',
                  connectionToken:connection.ConnectionToken,
                  connectionData:JSON.stringify(HUBS)
              }
aloysius-pgast commented 6 years ago

Hi. Thanks for noticing this. Bittrex did some changes yesterday which cause start step to fail when using this transport. I'll publish a new npm soon

aloysius-pgast commented 6 years ago

Fixed in version 1.0.3 of npm package. Tickers subscriptions should also work again (a new call to method SubscribeToSummaryDeltas was needed after the changes they did yesterday)

AndrewJDR commented 6 years ago

@aloysius-pgast Thanks!

Just curious, do you happen to know know if bittrex issued any kind of public warning about this change before they did it?

aloysius-pgast commented 6 years ago

The only information they provided was on their Slack, from what I saw in issue https://github.com/dparlevliet/node.bittrex.api/issues/67