admin管理员组文章数量:1406913
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: ining],
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:9443/ws/!bookTicker',
_req: null },
type: 'error',
message:
'getaddrinfo EAI_AGAIN stream.binance stream.binance:9443',
error:
{ Error: getaddrinfo EAI_AGAIN stream.binance stream.binance:9443
at GetAddrInfoReqWrap.onlookup [as onplete] (dns.js:56:26)
errno: 'EAI_AGAIN',
code: 'EAI_AGAIN',
syscall: 'getaddrinfo',
hostname: 'stream.binance',
host: 'stream.binance',
port: '9443' } }
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: ining],
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.:9443/ws/!bookTicker',
_req: null },
type: 'error',
message:
'getaddrinfo EAI_AGAIN stream.binance. stream.binance.:9443',
error:
{ Error: getaddrinfo EAI_AGAIN stream.binance. stream.binance.:9443
at GetAddrInfoReqWrap.onlookup [as onplete] (dns.js:56:26)
errno: 'EAI_AGAIN',
code: 'EAI_AGAIN',
syscall: 'getaddrinfo',
hostname: 'stream.binance.',
host: 'stream.binance.',
port: '9443' } }
Share
asked Jan 20, 2022 at 12:57
ALAEDDINALAEDDIN
2811 gold badge3 silver badges12 bronze badges
1 Answer
Reset to default 2For 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.:9443/ws/!bookTicker');
ws.onopen = function(message) {
console.log("Connected: ");
ws.pong();
}
ws.on("ping", function(message) {
ws.pong();
});
本文标签: javascriptcan39t resolve getaddrinfo EAIAGAIN errorStack Overflow
版权声明:本文标题:javascript - can't resolve getaddrinfo EAI_AGAIN error - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745055732a2639922.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论