0

I am currenlty working on a Symfony 6 project. Now I have the requirement to realize an environment in which a textarea field can be used by multiple users in real time. So that each user can see what the other types in this field.

My current implementation works like this:

  1. I have a textarea field with an Eventlistener for on "keyup" which starts an ajax call (post) to a server route. With this request the current value of the textarea field gets send to the route.
  2. At this route, the current value of the textarea field gets send back as an Update via the Mercure Hub to all subscribing clients.
  3. With an Eventsource the Update gets catched and the value of the textarea field gets updated.

This solution works in that all users can see the current content of the textarea field live and anyone can change the content. However, there are problems when typing something into the textareafield faster, because the time from Ajax request to receiving the update from Mercure Hub to adjust the textarea field value takes too long (about 200ms).

Does anyone have any idea how to optimize this?

schwaluck
  • 115
  • 9

0 Answers0