Answer the question
In order to leave comments, you need to log in
How to fix this error in NODEJS websockets?
Connected module https://github.com/TooTallNate/node-socks-proxy-agent . Despite the fact that it says Build Status Failing, the module works properly on wss
Here is the error that stops the script. I need the script to keep running:
events.js:72
throw er; // Unhandled 'error' event
^
Error: Connection Timed Out
at Socket.onTimeout (/home/admin/web/*/public_html/node_modules/socks-proxy-agent/node_modules/socks/lib/socks-client.js:55:20)
at Socket.g (events.js:180:16)
at Socket.EventEmitter.emit (events.js:92:17)
at Socket._onTimeout (net.js:327:8)
at Timer.unrefTimeout [as ontimeout] (timers.js:412:13)
exports.createConnection = function (options, callback) {
var socket = new net.Socket(), finished = false, buff = new SmartBuffer();
// Defaults
options.timeout = options.timeout || 10000;
options.proxy.command = commandFromString(options.proxy.command);
options.proxy.userid = options.proxy.userid || "";
var auth = options.proxy.authentication || {};
auth.username = auth.username || "";
auth.password = auth.password || "";
options.proxy.authentication = auth;
// Connect & negotiation timeout
function onTimeout() {
finish(new Error("Connection Timed Out"), socket, null, callback);
}
socket.setTimeout(options.timeout, onTimeout);
// Socket events
socket.once('close', function () {
finish(new Error("Socket Closed"), socket, null, callback);
});
socket.once('error', function (err) {
});
events.js:72
throw er; // Unhandled 'error' event
^
Error: socket hang up
at SecurePair.error (tls.js:1013:23)
at EncryptedStream.CryptoStream._done (tls.js:705:22)
at CleartextStream.read [as _read] (tls.js:496:24)
at CleartextStream.Readable.read (_stream_readable.js:320:10)
at EncryptedStream.onCryptoStreamFinish (tls.js:301:47)
at EncryptedStream.g (events.js:180:16)
at EncryptedStream.EventEmitter.emit (events.js:92:17)
at finishMaybe (_stream_writable.js:356:12)
at endWritable (_stream_writable.js:363:3)
at EncryptedStream.Writable.end (_stream_writable.js:341:5)
EventEmitter.prototype.emit = function emit() {
var type = arguments[0];
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._events || !this._events.error ||
(isArray(this._events.error) && !this._events.error.length))
{
if (arguments[1] instanceof Error) {
throw arguments[1]; // Unhandled 'error' event
} else {
throw new CasperError("Uncaught, unspecified 'error' event.");
}
}
}
if (!this._events) return false;
var handler = this._events[type];
if (!handler) return false;
if (typeof handler === 'function') {
try {
switch (arguments.length) {
// fast cases
case 1:
handler.call(this);
break;
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
// slower
default:
var l = arguments.length;
var args = new Array(l - 1);
for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
handler.apply(this, args);
}
} catch (err) {
this.emit('event.error', err);
}
return true;
Answer the question
In order to leave comments, you need to log in
So enter the captcha again. No one guarantees that the captcha will be requested only once. And it's probably still worth switching to the latest version of the API. Using an older version can also be suspicious. And suspicion causes captcha.
Well, the captcha is displayed due to frequent requests, as far as I know, therefore do not call more than 3 times per second, or use execute
Unhandled 'error' eventuncaught error event
socket.once('error', function (err) {
});
on thesocket.on('error', function (err) {
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question