mercredi 26 septembre 2018

Detect click on multiple devices in real time

I'm asking for your help because I need to make a webpage that need to communicate in real-time with different user and devices.

Device1 (on /page1) : simple page waiting for something to happen

Device2 (on /page2) : simple page with a button

I want my Device1 to know in real-time when Device2 have clicked the button.

At first, I started with simple AJAX (in a PHP environment), where my Device1 were requesting the server every 200 milliseconds to know if a click was triggered. My Device2 was sending the information when the user clicked. I'm aware this is a really bad solution, because of the number of requests I send to the server in a very short interval, and I would like to find something less greedy...

I heard about WebSockets, unfortunatly, it seems that WebSockets only works with Nodejs, and needs to be on a dedicated server.

Do you guys know if there are some alternatives to WebSockets that could fit my needs and can be hosted in a shared hosting ? I only need to detect a "click" from a device to another, nothing else.

Thank you very much for your help !!




Aucun commentaire:

Enregistrer un commentaire