This question is an exact duplicate:

How can I execute javascript function every 20-30 seconds (randomly from 20 to 30) without client participation? I have the usual hosting.

Reported as a duplicate by participants korytoff , LEQADA , VenZell , Abyx , Nick Volynkin 28 Dec '15 at 4:29 .

This question has been marked as a duplicate of an existing one.

  • On a regular hosting it is impossible to perform javascript on the server. I need hosting with node.js support. But in general, the problem is strange. It is better to write why you need it. - user194374
  • Making a tape measure. After completing the scrolling, I need to wait a couple of seconds and restart. Any suggestions ? - Slavik Okara
  • 2
    The @SlavikOkara algorithm is also relatively simple. The client makes a bet, clicks the "twist" request is sent to a server that randomly generates a number and immediately sends to the client. The client will already know this number in advance. Animation on the client takes 25 seconds (scrolling and stopping the roulette) + 5 seconds after stopping .... repeat - Alexey Shimansky
  • On the site, all people should have the same roulette, i.e. 20 people make bets for example for 20 seconds, then we spin the roulette and everyone should have the same roulette. - Slavik Okara
  • four
    I vote for the closure of this issue as not relevant to the topic, because it is clearly a duplicate of the question ru.stackoverflow.com/questions/478383/… - korytoff

1 answer 1

Your task is best done using websocket, which means using something other than php. For example, node.js, java. I can even advise a good tool-kit to create a web application on java, vertx.io . The authors were inspired by node.js, it's convenient and pleasant to work with it, I just use it for one project. And on php, this problem is quite difficult to solve, you can not do without crutches.

  • Rachet - not heard, no? - Alexey Shimansky