-
Notifications
You must be signed in to change notification settings - Fork 151
Open
Labels
Description
I have a periodic service in nodejs that tries to create 30-40 socket connections and close it in case (it gets connected successfully or some error occurs while connecting) but every now an then I get Maxmimum call stack size exceeded error at line connection.close()
My Code structure
const connection = ws.connect(socketServerUrl, (err) => {
if (err) {
// console.log the error
}
else {
connection.sendPing();
}
});
connection.on('error', (err) => {
const reason = err && err.message ? err.message : err;
// THIS IS WHERE I GET THAT MAX CALL STACK SIZE REACHED EXCEPTION
connection.close(); // release the connection
});
connection.on('pong', (data) => {
connection.close(); // release the connection
});
