简体   繁体   English

来自PHP后台进程的实时数据

[英]Real-time data from PHP background process

I'm currently working on a project that uses the twitter firehose to grab tweets and process/do an action on an Arduino. 我目前正在一个使用Twitter firehose捕获推文并在Arduino上处理/执行操作的项目。 The PHP that does all of this runs as a background process from terminal on my local machine. 完成所有这些操作的PHP从本地计算机上的终端作为后台进程运行。 What I'd love to do is somehow grab the data real-time on some sort of front end page without having to reload it every time. 我想做的是以某种方式在某种前端页面上实时获取数据,而不必每次都重新加载它。 So basically something like... 所以基本上像...

Guy tweets.. tweet is received and processed with PHP... Somehow tweet is then grabbed by front end and appended to list live on screen. 盖伊推文..推文已接收并用PHP处理...推文然后以某种方式被前端抓取并附加到屏幕上的实时列表中。

Would the only solution be to run a continuous jquery ajax call to see if new data exists in a SQL database? 唯一的解决方案是运行一个连续的jquery ajax调用以查看SQL数据库中是否存在新数据吗? Thanks guys! 多谢你们!

You need to do that on the client side. 您需要在客户端上执行此操作。 So, you can use ajax or websockets. 因此,您可以使用ajax或websockets。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM