AnnouncementsMatrixEventsFunnyVideosMusicAncapsTechnologyEconomicsPrivacyGIFSCringeAnarchyFilmPicsThemesIdeas4MatrixAskMatrixHelpTop Subs
1

Last night's movie night went great. I had finished up the code for that just an hour before we started. I'm glad things didn't break.

So now I'm just putting in a tiny bit more effort into general chat before I focus more on the movie aspect. Today's work started with a simple goal. I wanted the disconnect indicator (red dot) to show up in full chat. When I tested it the obvious thing to do was to disconnect my wifi to break the connection. Hmmm, it didn't show.

The issue is I've been relying on the onclose and onerror events to detect when to reopen a web socket. And as the intentional wifi disconnect proved this can delay firing for a very long time after there isn't a connection.

What was weird is if I reconnected the wifi and sent a message the server would get it, but the client wouldn't receive it back.

So two new things have been added. Health checks and a message buffer. A pong is sent very often. If the last pong we've seen is greater than a certain amount we close the websocket, thus actually triggering onclose, causing a new one to open. But an even stricter policy is that if we haven't seen a pong in a much shorter amount of time we consider the connection to be suspect. We push the message onto a buffer and reset the connection anyway. Heck if I wanted I could even set that policy lower than my pong rate. A chance a new websocket will open when a user sends a message doesn't really cost anything and is guaranteed to send the message on a fresh connection. The websocket is really more needed to get messages from others. Only reason to not do that is a 1/2 second delay that feels less responsive.

So right now the pong rate is 10 seconds.
The manual close is 40 seconds without seeing a pong.
We need to have seen a pong within the last 10 seconds for a connection to be good enough to send out.

That pong rate is pretty high but I don't want chat to eat a message ever. Maybe I'll raise it.

Of course any modification of code can have the opposite impact so do play with chat and tell me if there are issues.

Edit: Now the question is how much UI I want to add to the movie stuff. Using the command '/add url' can add content. Will enough of the right people remember that or do I need to add another input bar?

Comment preview