Socket Hang Up Error

Hi Developers, so I create a class called onShout. It fires when a group shout is fired from ROBLOX group. The code works fine, but after a certain amount of time, it gives and error socket hang up. How do I fix this problems?

CODE:

const rbx = require('noblox.js');
module.exports = class OnShout {
    constructor(bot,config) {
        let onShout = rbx.onShout(Number(config.group));
        onShout.on('data', function(post) {
            if (post.body && post.body.length !== 0) {
                bot.guilds.cache.get(config.guild).channels.cache.get(config.channel).send(post.body)
            }
        });
    }
}
1 Like

It could be on Roblox’s side.

could u elaborate?

Maybe Roblox’s APIs could not be working as intended at the moment.

I am not exactly sure but, I think on shout works like a loop. it will check every now and then if the shout changed.

It means that after 5 minutes Glitch projects shut off, therefore closing your connection. If you’re trying to run a bot, move to repl with uptimerobot. Ideally we need Glitch’s smooth editor on Repl’s hosting.

I am running the program locally.

That’s strange then

is there anyway stop this loop?

it seems to be a discord.js error. I had this error before. I solved it by just restarting the project. You can also, remix the project and see if that stops it.

It is caused by Glitch closing the connection to Discord.

I hosted it locally

Oh, then check to see if your firewall or ISP is blocking the request.

1 Like

They like to do that sometimes.

1 Like

And if you have Comcast. You may need admin.They release a new feature in early 2020 where they would block request going to your devices. It blocked Glitch’s CDN for some reason, but when I disabled it, it fixed everything.

1 Like

Disabling Advanced Protection worked for me. It’s located here.

Xfinity (Comcast) is designed for non tech savvy people.

3 Likes

Even Xfinity Business is like that. They are not thinking about all the people who use their internet for developing.

2 Likes

If you live in the us, there are not many more options. Internet is kind of a monopoly here.

3 Likes

I found another solution I just use SetInterval(), can manually invoke the event. So it checks for every 10 minutes