SO-ChatBot icon indicating copy to clipboard operation
SO-ChatBot copied to clipboard

inital boilerplate for sharing sockets to make this effecient

Open awalgarg opened this issue 9 years ago • 6 comments

couple of things you will need to do after applying that patch: edit the loader.user.js script to point to whatever locally hosted master.js file's url is (can't be file:// obviously). need to install the new socket-saver.user.js file as well (and make sure it runs-at document-head). I will merge the two in a single script if you think it is working fine.

awalgarg avatar Sep 21 '15 17:09 awalgarg

I don't get it.

What is this?

Why is this?

What does it do?

Why did you add another userscript?

Zirak avatar Sep 21 '15 20:09 Zirak

this supposedly corrects the issue where cap is getting constantly logged out. something about sharing the socket and not creating a new one.

rlemon avatar Sep 21 '15 20:09 rlemon

yeah same what lemon said. chat creates a socket, then bot creates another one, so there are two sockets when there should be just one. add to it any other sockets created if cap ever opens another tab (which surely is closed instantly but still, it is made).

chat hangs due to this at the loading... page. if we save the socket (which the added userscript does), we can share it for the bot, and chat doesn't hang anymore.

@rlemon I dunno about the "keep getting logged out" thing. This only fixes freezing at the loading... page.

awalgarg avatar Sep 22 '15 05:09 awalgarg

http://i.imgur.com/MVfRrhw.png from http://chat.stackoverflow.com/transcript/17?m=25841748#25841748 is the issue it fixes.

awalgarg avatar Sep 22 '15 05:09 awalgarg

Interesting. Were you able to figure out why this happens? Is it a new thing? I create another socket sometimes myself in the chat and it never mysteriously hung up on me. Maybe it's because two sockets were created close in time to one another?

The PR generally looks good, there're two issues keeping me from merging, I'll comment inline.

Zirak avatar Sep 22 '15 06:09 Zirak

It happens because chat's backend is silly and randomly 404s on 100% valid requests. I'd blame it on badly implemented rate-limiting.

awalgarg avatar Sep 22 '15 06:09 awalgarg