Mathieu2301 / TradingView-API

📈 Get real-time stocks from TradingView
1.47k stars 334 forks source link

ENOTFOUND event not being handled #119

Open gbarton opened 2 years ago

gbarton commented 2 years ago

Describe the bug The websocket code in Client I think somewhere isn't listening for onError event and throws up the whole app as a result.

node:events:498
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND data.tradingview.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26)
Emitted 'error' event on WebSocket instance at:
    at emitErrorAndClose (/workspaces/trading/node_modules/ws/lib/websocket.js:835:13)
    at ClientRequest.<anonymous> (/workspaces/trading/node_modules/ws/lib/websocket.js:697:5)
    at ClientRequest.emit (node:events:520:28)
    at TLSSocket.socketErrorListener (node:_http_client:442:9)
    at TLSSocket.emit (node:events:520:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'data.tradingview.com'
}

To Reproduce Easiest is to create a client/chart combo with computers internet turned off.

Expected behavior I would like client.onError() to receive this error from the websocket stream so I can handle it and retry later.

trungnt1008 commented 1 year ago

Hi mans, did anyone resolve it?

HoeGaatie1611 commented 1 year ago

Having the same issue unfortunately, any good fixes yet?

kiaxseventh commented 1 year ago

onError does not work any time For example, it doesn't even handle timeout errors

dear @Mathieu2301 please check it thank you 🙏🏻