Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

368
Vistas
can't resolve getaddrinfo EAI_AGAIN error

I'm having this error after 20 min of running my NodeJS app, and it's keeps appearing after that.. it's hosted at AWS (EC2) I searched for getaddrinfo EAI_AGAIN errors, it's probably caused by DNS issue, but i have no idea how to solve it.

WebSocket error: [object Object]
ErrorEvent {
  target:
   WebSocket {
     _events:
      [Object: null prototype] {
        message: [Function: incoming],
        disconnect: [Function],
        close: [Function: close],
        error: [Function] },
     _eventsCount: 4,
     _maxListeners: undefined,
     _binaryType: 'nodebuffer',
     _closeCode: 1006,
     _closeFrameReceived: false,
     _closeFrameSent: false,
     _closeMessage: '',
     _closeTimer: null,
     _extensions: {},
     _protocol: '',
     _readyState: 2,
     _receiver: null,
     _sender: null,
     _socket: null,
     _bufferedAmount: 0,
     _isServer: false,
     _redirects: 0,
     _url: 'wss://stream.binance.com:9443/ws/!bookTicker',
     _req: null },
  type: 'error',
  message:
   'getaddrinfo EAI_AGAIN stream.binance.com stream.binance.com:9443',
  error:
   { Error: getaddrinfo EAI_AGAIN stream.binance.com stream.binance.com:9443
       at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
     errno: 'EAI_AGAIN',
     code: 'EAI_AGAIN',
     syscall: 'getaddrinfo',
     hostname: 'stream.binance.com',
     host: 'stream.binance.com',
     port: '9443' } }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

For future readers, the problem is caused because the Binance's web socket server requires to respond to a ping frame within 10 minutes or the connection will be disconnected, so I get the 1006 error, I fixed this issue with a pong frame like this: ws.pong(); otherwise you will get a 1008 error code.

Example:

const ws = new WebSocket('wss://stream.binance.com:9443/ws/!bookTicker');
ws.onopen = function(message) {
    console.log("Connected:   ");
    ws.pong();
}
ws.on("ping", function(message) {
    ws.pong();
}); 
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda