How to change html site when B does something

Let's say we have users A and B who visit the same URL containing the button. When A clicks on a button, I want something on B's website to change immediately when B is on it, for example. The text to add. I want this to happen with a delay of less than 150 ms.

Is it realistic? Could you give me tips on what I should look for, or examples of toys that illustrate this? Thank.

+3
source share
3 answers

I think you should take a look at the Push / Comet server. The NGNX push module is now very popular: http://pushmodule.slact.net/

Here's how you can create a chat room, for example. At least that sounds like you explained.

**** **** update

As for your latent question, I do not think that 150 ms is realistic, you understand that this is a full round, at least, plus reading and writing to the database. The survey will not give you a very pleasant experience for the user, because your JS may decide to send a response right before the user performs the action, and you will have to wait until your JS sends the request to user “B” again to see the update. Could it be a long time, maybe 10 seconds? In my opinion, you would not use a poll because it is very wasteful and makes caching pretty tough.

. , Apache push-, Nginx.

+5
+1

php mysql - . -, ? , php, A B.

0

Source: https://habr.com/ru/post/1733468/


All Articles