Author Topic: web, the server updates the client on event: how?  (Read 1630 times)

0 Members and 1 Guest are viewing this topic.

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 5090
  • Country: gb
web, the server updates the client on event: how?
« 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?  :-//
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3169
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: web, the server updates the client on event: how?
« Reply #1 on: October 14, 2022, 12:27:01 am »
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.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 
The following users thanked this post: DiTBho

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8349
  • Country: fi
    • My home page and email address
Re: web, the server updates the client on event: how?
« Reply #2 on: October 14, 2022, 02:46:46 am »
I'd recommend Websockets.  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.
 
The following users thanked this post: DiTBho


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf