Any way to fix socket hang up problem?


#21

This doesn’t make project live instead it makes the project running but without live icon​:joy::joy:


#22

I have it loading but all my bots runinning still :laughing: (ignore the main man. I didn’t make him)


#23

That doesn’t gonna help i know that is mee6(main) my problem is socket hang up and that thing you’re talking about is pinging bot every 5 minutes is not make your glitch app live making your discord app online doesn’t make your app liveScreenshot_2018-06-06-09-27-08 This is the live thing , i am talking about so don’t give your ideas. I am already using uptimerobot to ping my bot every 5 minutes . Read my question properly before talking about anything!
Your bot is still on loading so they will be damn slow!


#24

The code above will host a http server on port 3000 (outpus at 80 on {project}.glitch.me), it pings the http server every 5 minutes.


#25

To get the live icon, your project needs to respond successfully (200 OK) to an HTTP request on port 3000.


#26

Then how about

require('http').createServer(async(r,s)=>{s.statusCode=200;s.end('ok')});setInterval(()=>{require('http').get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`)},60*5*1000)

#27

Using setInterval() to keep a bot awake isn’t recommended as it will not be restarted if we have to stop projects. Using an external service like uptimerobot to request an end-point would be a more reliable solution.


#28

Ah, right. Cool :+1:


#29

This doesn’t even fix my issue idk why i am always getting error socket hang up please fix this glitch @Tim


#30

I suggest adding catch blocks around that error so you have some more info to work on as to what is causing the socket to hang up.


#31

This is happening during start of project i am already using catch but that doesn’t help and i don’t know why this is happening. Maybe this is due to request limit or something?


#32

What error do you get in the catch? Request limits return a 429 error response.


#33

This returns error from discordapp.com


#34

What’s the error text from discord?


#35

That’s a long error and it gone because i can’t see old log :disappointed::disappointed::disappointed:


#36

` _pendingData: null,

    _pendingEncoding: '',

    server: undefined,

    _server: null,

    ssl: null,

    _requestCert: true,

    _rejectUnauthorized: true,

    parser: null,

    _httpMessage: [Circular],

    read: [Function],

    _consuming: true,

    write: [Function: writeAfterFIN],

    _idleNext: null,

    _idlePrev: null,

    _idleTimeout: -1,

    [Symbol(asyncId)]: 27,

    [Symbol(bytesRead)]: 0 },

 connection: 

  TLSSocket {

    _tlsOptions: [Object],

    _secureEstablished: false,

    _securePending: false,

    _newSessionPending: false,

    _controlReleased: true,

    _SNICallback: null,

    servername: null,

    npnProtocol: null,

    alpnProtocol: null,

    authorized: false,

    authorizationError: null,

    encrypted: true,

    _events: [Object],

    _eventsCount: 9,

    connecting: false,

    _hadError: true,

    _handle: null,

    _parent: null,

    _host: 'discordapp.com',

    _readableState: [Object],

    readable: false,

    domain: null,

    _maxListeners: undefined,

    _writableState: [Object],

    writable: false,

    allowHalfOpen: false,

    _bytesDispatched: 279,

    _sockname: null,

    _pendingData: null,

    _pendingEncoding: '',

    server: undefined,

    _server: null,

    ssl: null,

    _requestCert: true,

    _rejectUnauthorized: true,

    parser: null,

    _httpMessage: [Circular],

    read: [Function],

    _consuming: true,

    write: [Function: writeAfterFIN],

    _idleNext: null,

    _idlePrev: null,

    _idleTimeout: -1,

    [Symbol(asyncId)]: 27,

    [Symbol(bytesRead)]: 0 },

 _header: 'GET /api/v7/gateway HTTP/1.1\r\nHost: discordapp.com\r\nAuthorization: MzU4Nzg1MDIzMjg2OTY4MzIz.Db-Gsg.gyIt2ajHXLKqHDxlJz1LvqRjmS4\r\nUser-Agent: DiscordBot (https://github.com/discordjs/discord.js, 12.0.0-dev) Node.js/v8.9.4\r\nAccept-Encoding: gzip, deflate\r\nConnection: keep-alive\r\n\r\n',

 _onPendingData: [Function: noopPendingOutput],

 agent: 

  Agent {

    domain: null,

    _events: [Object],

    _eventsCount: 1,

    _maxListeners: undefined,

    defaultPort: 443,

    protocol: 'https:',

    options: [Object],

    requests: {},

    sockets: [Object],

    freeSockets: {},

    keepAliveMsecs: 1000,

    keepAlive: true,

    maxSockets: Infinity,

    maxFreeSockets: 256,

    maxCachedSessions: 100,

    _sessionCache: [Object] },

 socketPath: undefined,

 timeout: undefined,

 method: 'GET',

 path: '/api/v7/gateway',

 _ended: false,

 res: null,

 aborted: undefined,

 timeoutCb: null,

 upgradeOrConnect: false,

 parser: null,

 maxHeadersCount: null,

 [Symbol(outHeadersKey)]: 

  { host: [Array],

    authorization: [Array],

    'user-agent': [Array],

    'accept-encoding': [Array] } } }

:apple::waxing_crescent_moon: Your app is listening on port 3000

[2018-06-10 16:07:58] Loading a total of 160 commands.

[2018-06-10 16:07:59] Loading a total of 12 modules.

[2018-06-10 16:07:59] Loading a total of 12 events.

`


#37

Here is the error @Gareth


#38

It looks like you missed the start of the error, the JSON is incomplete.


#39

@ArunKapil01Is it a Discord Bot? Ifso, I can help…

And to get a project that also lives forever without a code, use uptimerobot.com.

First of all, because of the massive error I suggest you privatly message me your package.json file so I can see if it is in there.

But because it’s nothing important you also may post it in here if you would like, your choice!

~Rienknr1


#40

I am already using that and socket hang up error is still here