I
I
ipoluda2020-02-25 17:02:09
client-server
ipoluda, 2020-02-25 17:02:09

How to organize the updating of data on the page at the initiative of the server?

In general, the essence of the question is in the title. There is, for example, ajax, with which you can dynamically update information on the page. But usually such an update occurs at the initiative of the client. That is, for example, he pressed a button, the information from the server was pulled up and updated on the page. But I need the opposite. There is a page, and on it, for example, the current temperature in the room is displayed. Is there a way to somehow change this number on the page without having to poll the server every second?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stalker_RED, 2020-02-25
@Stalker_RED

https://ru.wikipedia.org/wiki/WebSocket
or https://javascript.ru/ajax/comet/long-poll

A
Adik Izat, 2020-02-25
@JaxAdam

This is a good article.

G
granty, 2020-02-26
@granty

There is a Server-Sent Events technology, here is a recent question about updating data on a page at the initiative of the server , just on this topic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question