Error: WebSocket is not open: readyState 2 (CLOSING)
at WebSocket.send (/home/minecraft/mixer-bot/node_modules/ws/lib/websocket.js:322:19)
at ConstellationSocket.sendPacketInner (/home/minecraft/mixer-bot/node_modules/carina/dist/commonjs/socket.js:243:21)
at Timeout._onTimeout (/home/minecraft/mixer-bot/node_modules/carina/dist/commonjs/socket.js:281:23)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)
I'm not sure what's causing this, only thing I thought of to do was post on here.
This is all of my Carina code:
const ca = new Carina({ isBot: true }).open();
ca.subscribe('channel:' + bot.chanID + ':followed', data => {
if (bot.settings.follow_alerts == 1 && data.following && !(followed_names.includes(data.user.username.toLowerCase()))) {
msg_queue.push([`@${data.user.username} has just followed! FOLLOW HYYYYYPE! <3 <3 <3`]);
followed_names.push(data.user.username.toLowerCase());
}
})
.catch(error => {
console.error('[%s] Something went wrong.', getDateTime());
console.error(error);
});
if (bot.nameL == "botname") {
ca.subscribe('channel:' + bot.chanID + ':update', data => {
if ('online' in data && Object.keys(data).length > 1 && data.online === true) {
client[bot.nameL].request('GET', 'channels/' + channelId)
.then(response => {
let body = response.body;
const discSock = new ws('ws://localhost:****/');
discSock.on('open', function open() {
discSock.send(JSON.stringify({type: "mixerLive", data: {body}}));
});
})
.catch(error => {
console.error('[%s] Something went wrong.', getDateTime());
console.error(error);
});
}
})
.catch(error => {
console.error('[%s] Something went wrong.', getDateTime());
console.error(error);
});
}
Hey!
Lately I've been getting this randomly after hours of my mixer bot running without issues;
/home/minecraft/mixer-bot/node_modules/ws/lib/websocket.js:328 throw err; ^
Error: WebSocket is not open: readyState 2 (CLOSING) at WebSocket.send (/home/minecraft/mixer-bot/node_modules/ws/lib/websocket.js:322:19) at ConstellationSocket.sendPacketInner (/home/minecraft/mixer-bot/node_modules/carina/dist/commonjs/socket.js:243:21) at Timeout._onTimeout (/home/minecraft/mixer-bot/node_modules/carina/dist/commonjs/socket.js:281:23) at ontimeout (timers.js:498:11) at tryOnTimeout (timers.js:323:5) at Timer.listOnTimeout (timers.js:290:5)
I'm not sure what's causing this, only thing I thought of to do was post on here.
This is all of my Carina code: