Re:Server Sent Events
by marcellus23 on Monday May 15, 2023 @03:51PM
(#35953570)
What was the challenge in typing indicators? My naive idea is that it's basically sending `typing_started` and `typing_ended` messages.
[ Parent
| on HN ]
You can skip the "typing ended". You're gonna need a shortish timeout anyway, may as well just let the "typing is happening" messages all terminate by timeout.
Re:Server Sent Events
by marcellus23 on Monday May 15, 2023 @05:06PM
(#35954491)
That really depends on the UX you want.
What do you have in mind? I can't think of a case where you'd want "X is typing" to persist more than a second or maybe two past the last-received message that affirmed X is, in fact, still typing. I can think of cases in which a short timeout might break down in bad ways (making the notice really jittery on high-latency connections, say) but I think those are probably just situations in which any "... is typing" message is simply gonna be bad in one way or another.
You don't want to clear it after only a second. It should persist much longer since people pause and think between words.
It's common that someone starts typing but immediately change their mind and clears the input after only a couple of characters. So if the timeout is longer you need an "ended" event.
Re:Server Sent Events
by bongobingo1 on Tuesday May 16, 2023 @10:42AM
(#35962558)
(the "ended" event is the message being sent.)
Re:Server Sent Events
by yencabulator on Wednesday May 17, 2023 @02:54PM
(#35979617)
Except for the scenario the parent is talking about:
> It's common that someone starts typing but immediately change their mind and clears the input after only a couple of characters.
I'm guessing that since it's not a full-duplex connection you have to send those messages out-of-band, ie, with a separate POST request API
Re:Server Sent Events
by hamandcheese on Monday May 15, 2023 @04:09PM
(#35953807)
But messages themselves are already sent out-of-band as a POST request, if I understand correctly. Don't see why that couldn't be extended to include typing indicators.