AJAX-Chat
AJAX-Chat copied to clipboard
Add slowdown to reduce ajax rate…
... if user is not actively typing messages. So e.g. normal ajax rate is every 2s, but if user has not sent anything for say 60 seconds, then the ajax rate slows to e.g. every 10s until they send something again. This will assist with scalability by reducing the number of ajax calls being made.
Also:
- Add debugging setting / console.log messages / alerts.
- Correct the retry timeout calculation which looked incorrect.
- Add a status blinking icon to the logs screen
- Add classes on the #content div so you can distinguish between chat and log views in custom css.
- Using 4., avoid need to show log settings by setting chatbox right margin on logs.
The slowdown will need to be an option because I know some users keep chat open for long periods and just read, but don't want a 10s wait between updates. I'd get complaints from my users. In a busy room it would result in lumping messages together a lot (while in an idle room it would certainly save bandwidth for all).
I plan to introduce real user statuses soon (v0.9.1?). Specifically this was for an afk status, but an automatic status of idle would also work for this. Rather than gradually slow, I would have users hit idle after x seconds and then slow their updater. That way they know their status has been slowed.
I need to review the retry timer calc. You may be right, I made that ages ago as a patch to force an update after many users reported needing to send a message to wake chat up after it randomly fell asleep on connection problems.
Since I'm now using the testing branch, I will merge this into master because why not.
If you could though, keep the pull requests to individual items so I don't have to toss your request if I have a problem with one of them ;)
The time since last message before slowdown and the rate after slowdown are both new options set in config,js.
Oh I see. Sorry. I'll add it now and later have it flag them as idle.
Maybe it would be good to slow the chat down if it isn't in focus?