-
Notifications
You must be signed in to change notification settings - Fork 60
inital boilerplate for sharing sockets to make this effecient #249
base: master
Are you sure you want to change the base?
Conversation
I don't get it. What is this? Why is this? What does it do? Why did you add another userscript? |
this supposedly corrects the issue where cap is getting constantly logged out. something about sharing the socket and not creating a new one. |
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. |
http://i.imgur.com/MVfRrhw.png from http://chat.stackoverflow.com/transcript/17?m=25841748#25841748 is the issue it fixes. |
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. |
It happens because chat's backend is silly and randomly 404s on 100% valid requests. I'd blame it on badly implemented rate-limiting. |
socket.onmessage = this.ondata.bind( this ); | ||
socket.onclose = this.socketFail.bind( this ); | ||
var socket; | ||
// socket-saver extension specific code: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
openSocket
is called (eventually) from /join
to, well, join a room. That's why there's the discard
option...
So we either fix up /join
to do something else or change openSocket
or its caller to match the new behaviour.
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.