My ubuntu server can’t connect to binance websockets with nodejs (errno: -111 | code: 1006 ECONNREFUSED)

1.3k views Asked by At

Im getting this message when i try websockets connection with nodejs:

[
  'WebSocket error: heStzDmfg5HKgWKGUHwrGss2EXhnB29vXeNsIay55NNAG7FUx7RuelXQXaKW (ECONNREFUSED) connect ECONNREFUSED 52.198.55.31:9443'
]
[
  Error: connect ECONNREFUSED 52.198.55.31:9443
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
    errno: -111,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '52.198.55.31',
    port: 9443
  }
]
[
  'WebSocket closed: heStzDmfg5HKgWKGUHwrGss2EXhnB29vXeNsIay55NNAG7FUx7RuelXQXaKW (1006)'
]

BTW on my local machine it does work just fine. It doesnt work when i run the code on the server because of this error.

How do i make it work?

1

There are 1 answers

1
O. Jones On

ECONNREFUSED means no server is running on the port you try to access (9443) on the machine mentioned in your connection attempt.

So doublecheck the ip address and port, then make sure the server is running. Websocket servers are also https servers (the 443 in 9443 hints at https rather than http ) so try connecting with a browser.