node-irc icon indicating copy to clipboard operation
node-irc copied to clipboard

Detect client timeout ?

Open steadexe opened this issue 11 years ago • 11 comments

Hello,

I am sorry to open a new issue but I looked at all issues about detecting when the client timeout but I didn't found a working solution, or something understandable. In every issues I saw they were all doing a redirection loop a mention loop.

So can someone help me found a solution please ? I have see the idea of send PING request, but who should ping who ?

Thanks for helping and have a nice day!

steadexe avatar Jun 11 '15 11:06 steadexe

You can send a ping message to the server and then await a response (pong). You will be sending the ping to the IRC server you are connected to. If the response if not received within a given amount of time you can assume your client to be disconected.

dozmus avatar Jul 01 '15 18:07 dozmus

Thanks

2015-07-01 20:38 GMT+02:00 Pure_ [email protected]:

You can send a ping message https://tools.ietf.org/html/rfc2812#section-3.7.2 to the server and then await a response (pong). You will be sending the ping to the IRC server you are connected to. If the response if not received within a given amount of time you can assume your client to be disconected.

— Reply to this email directly or view it on GitHub https://github.com/martynsmith/node-irc/issues/375#issuecomment-117791303 .

steadexe avatar Jul 02 '15 06:07 steadexe

There is a patch I submitted a while ago to add ping timeouts, but it was during the attempted restructuring and probably got lost among the chaos. Here's a link: https://github.com/martynsmith/node-irc/pull/214

philip-peterson avatar Jul 03 '15 17:07 philip-peterson

I will try to patch and see if it works! Thanks for help bro

steadexe avatar Jul 04 '15 08:07 steadexe

So many things had changed, it seems to be broken now :(

steadexe avatar Jul 04 '15 10:07 steadexe

I bind a PING event, but the bot still not detecting it. Did you put autoreconnect: true ? or something like this somewhere ?

Thanks for help

2015-07-28 17:38 GMT+02:00 Booster2ooo [email protected]:

I had the same trouble, I tried to attach a PING and a RAW event in order to test/debug the issue and it seems that attaching a PING event to the client solve the problem... give it a try?

— Reply to this email directly or view it on GitHub https://github.com/martynsmith/node-irc/issues/375#issuecomment-125656904 .

steadexe avatar Jul 29 '15 18:07 steadexe

Sorry, I removed my reply because it was irrelevant. In my code, I used autoconnect true. Did you try to listen to the 'close' event ? If it doesn't solve the problem, you might try to send() a ping at regular interval... maybe ?

Booster2ooo avatar Jul 30 '15 07:07 Booster2ooo

I fixed the problem, everytime I receive à PING from the server, it start a timer for 5 minutes, if it receive an another PING it reset the timer, so if the timer trigger it attempt to reconnect and reset the timer. So the bot will auto reconnect but manually.

2015-07-30 9:02 GMT+02:00 Booster2ooo [email protected]:

Sorry, I removed my reply because it was irrelevant. In my code, I used autoconnect true. Did you try to listen to the 'close' event ? If it doesn't solve the problem, you might try to send() a ping at regular interval... maybe ?

— Reply to this email directly or view it on GitHub https://github.com/martynsmith/node-irc/issues/375#issuecomment-126205473 .

steadexe avatar Jul 30 '15 07:07 steadexe

Related to #76.

katanacrimson avatar Sep 04 '15 16:09 katanacrimson

The pull request was reopened, i believe a merge is possible.

@philip-peterson i hope it would be pretty simple to re-merge this since you already spent time on it before, not sure if thats possible though.

ghost avatar Sep 11 '15 01:09 ghost

This is fixed with #418 and #452.

jirwin avatar Mar 24 '16 18:03 jirwin