EEVblog Electronics Community Forum
Products => Computers => Programming => Topic started by: DiTBho on October 14, 2022, 12:23:20 am
-
Usually the web server serves a page at the client's request.
I need the server to update the client in case of an event.
how? :-//
-
Usually the web server serves a page at the client's request.
The simplest way is to poll for updates.
But you can also look to Push notifications, or Websockets.
-
I'd recommend Websockets (https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API). The idea is that the page contains JavaScript that connects to the server using Websockets, and assigns a function to handle the MessageEvents for that socket. That way, whenever the server sends something, that Javascript handler gets called.
See the link for further info, guides, and so on.