0

Ok, so I'm in the starting stage of a new project where I have an apache web server with PHP included and a MySQL database.

The main focus aim of this project is to show data in this MySQL database as real time on the web page. The problem I have is I am not allowed to install any new software on the server, so I cannot use nodejs or socket.io

I've been looking at the PHP long polling possibility, but I'm curious if anyone out there has managed to pull off something similar without grinding their server to a halt due to too many threads being used.

I've heard about comet, but not sure how that would work as from reading it seems to just look at flat files, not databases.

Thanks for any help.

Richard C
  • 401
  • 1
  • 5
  • 19
  • You have a solution here: https://stackoverflow.com/questions/333664/how-do-i-implement-basic-long-polling – 4EACH Apr 14 '18 at 20:17
  • @4EACH Is this long polling though or is the solution an example of refreshing at interval? From what I have read, this type of activity causes strain on the servers (might be wrong) as if there is 10000 users on this page, thats 10000 threads that it will consume one the server – Richard C Apr 14 '18 at 20:22
  • It based on intervals, one long interval and shorter intervals for success and failure responses. The connection still open so you don't need to connect to server many times. i didn't test it but you can try it. – 4EACH Apr 14 '18 at 20:33

1 Answers1

0

This is easily achievable with jquery and php, create a php file and echo json encoded data in return. Usage can be found here: jquery post

Seann
  • 81
  • 1
  • 6