Suppose I synchronize the text on an HTML page stored in localStorage from computer A to computer B. When a user edits the text on computer A, I send a request to the server and tell what text was changed. Is there a way I can get the server to tell computer B that the new text, without computer B, should continue to check? I read about comets, but I try not to use any libraries. Is there any way? Also, if you intend to offer a comet, could you give a simple example using normal JavaScript and comets?
I had an idea, but I donβt know if it will work. On computer B, I send the request once and let the server file defer the response until new text appears. This way, it will look like a long poll, but the request will ultimately be a timeout. If there was a way to set the timeout so that it never was, it would be much easier. So who has any ideas?
PS- I want to use only JavaScript and PHP and try to avoid using libraries. However, if you know of a library that can do this using JS and PHP, please tell me anyway.
In addition, I know that there were such questions, but the answers I found there were unsatisfactory.
Oh, and if anyone knows how chat works here, could you tell me this?
tl; dr: I want to send a request from the server to an HTML page or send an HTML request to one request, which is saved until the corresponding response is created.
source share