V
V
VovaSarp2017-11-09 08:16:01
Communication protocols
VovaSarp, 2017-11-09 08:16:01

Chat on SignalR / Websocket - how to see in real time what the user is typing?

As VK when writing a message by another user, the inscription "User is typing a message" is displayed, only to see the text of the message itself.
So far, only a terrible solution has come to mind: after each printed character, make an AJAX request to the database and save the current state of the message, which is extremely unproductive.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor, 2017-11-09
@VovaSarp

It is more logical not after each character, but with a delay. From the experience of implementing this function, I’ll say that it’s better if you send a message about 300 ms after the last keyup event call.
I don’t know how it is exactly in SignalR, but it seems to me that you can not save it to the database, but immediately send it to chat users. Since it is not scary if one of these messages is lost, as the next one will come soon.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question