TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,787
  • Total Topics: 21,281
  • Online today: 65
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 57
  • Total: 57

Typing fast in the shoutbox leads to loss of charachters

Started by sgm09, April 22, 2025, 03:35:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sgm09

Link to my forum: offline/secret
SMF version: 2.1.4
TP version: 3.0.2
Default Forum Language: English
Theme name and version: Lunarfall
Browser Name and Version: firefox
Related Error messages:

With firefox, some charachters are lost when typing fast. Pretty annoying, confirmed by at least two users.
In chrome it looks like it's lagging a bit every now and then when typing fast, but it doesn't lose them, they just appear with a slight delay on screen. Didn't check, but looks like some javascript is processing the text stream and some buffer is lost. Not sure why that's needed.

@rjen

I am not aware of this issue, cannot say I experienced it, nor have I heard it before (at least I cannot remember)

Just an idea: what did you set for this setting in the shoutbox?: Auto refresh in seconds (0 = disabled)
Running Latest TP on SMF2.1 at: www.fjr-club.nl

sgm09

Yeah that was it, was set to 2 seconds, changed it to 10 and i can't really observe any more char losses when typing. It was happening all over the forum where the shoutbox appeared. Maybe the code for chat can be improved, surely there must be a way to get live chat without stutters.

@rjen

Perhaps, it's an Ajax call. Setting it every 2 seconds is really too much.
Running Latest TP on SMF2.1 at: www.fjr-club.nl

sgm09

I still lose 1-2 chars every 10 (N) seconds though, still annoying.

In tpshout.js, async is set to false:
   $.ajax({
      type : "POST",
      dataType: "html",
      cache: false,
        async: false,

is there any reason for this ?

Chatgpt also suggested to detect keystrokes in js, and delay the update interval by 500ms each time it detects typing. This might not be a perfect fix though, if you happen to make a ~500ms pause when typing.

Best solution would be to use websockets.

@rjen

I believe you, the current code is ancient.

Our challenge is, that in order to fundamentally change this code we need development capacity. Most of us do not have the skills to make these changes (I know I don't). I suspect @tino would be able to do it, but I doubt if he has time to do that.

let's wait for him to chime in though...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

sgm09

Well, I had luck with chatgpt/claude developing two small mods for me that actually worked. Might try that route if nothing else happens :P

There's two things that need fixing. The charachter loss on typing when the ajax call is done, and the scroll reset to the end of the chat at the same ajax call, when someone is doing a scroll to chat history in the box.

This website is proudly hosted on Crocweb Cloud Website Hosting.