The poloniex Push API through websocket always close in nodejs

719 views Asked by At

I got one problem when using the Push API of poloniex. Currently im testing on nodejs version 8. This is my package.json

{
  "name": "abc",
  "private": true,
  "version": "1.0.0",
  "description": "abc",
  "keywords": [],
  "dependencies": {
    "autobahn": "^17.5.2"
  }
}

I used the sample code from poloniex suggestion like this link https://pastebin.com/dMX7mZE0

But when i run on local, the console always log Websocket connection closed Could anyone know how to pass this issue? please help. Could you guys give me some solutions like enable which port, protocol, what to do, etc

Thank you for any comments and answers.

Summer

2

There are 2 answers

0
Nguyen Le On

I know the problem, I had used docker to run nodejs. So i didn't expose the port 80 & 443 to outside. So it makes the app cannot subscribe to web socket.

0
sfmiller940 On

I've been using poloniex-api-node with WebSocket API (v2):

The new WebSocket API (v2) is not yet officially documented, however its functionality is much faster and reliable. WebSocket API (v2) is also internally used by Poloniex.

...

poloniex.openWebSocket({ version: 2 });

It seems much more stable than version 1.