实时数据更新有什么思路可以完成?
比如,实现一块区域专门进行最新留言的展示.. 每次有最新的留言就把它显示在上面..
(比如人人影视右下角的“精彩评论”, 不知道是不是实时的)
再比如,做一个网站,抓取其他网站上的信息,比如租房价格。
但是其他网站上的租房价格的更新并不是定时的。
对于这些实时更新的需求? 有什么思路可以完成?
回复内容:
比如,实现一块区域专门进行最新留言的展示.. 每次有最新的留言就把它显示在上面..
(比如人人影视右下角的“精彩评论”, 不知道是不是实时的)
再比如,做一个网站,抓取其他网站上的信息,比如租房价格。
但是其他网站上的租房价格的更新并不是定时的。
对于这些实时更新的需求? 有什么思路可以完成?
这个需求跟在线聊天类似
- ajax频繁请求
- 长轮询
可以看看这篇[文章](http://blog.leezhong.com/tech/2011/03...)
- websocket (开源swf库可以解决低版本浏览器的兼容,swf需要服务器端的一个授权)
swf开源库:[https://github.com/gimite/web-socket-...](https://github.com/gimite/web-socket-...)
这里我写了段简单的服务器端授权[代码](https://github.com/xiaozi/PolicyServe...)
如果服务端没有要求...node比较好点吧..
socket.io..多种方案,也支持多种浏览器
到现在为止的成熟方案似乎包括tornado, node, erlang, 另外不知道go实现的怎么样, python里面还有一堆gevent, greenlet可以用, twisted也可以考虑. PHP多线程或多进程就别想了.
在产品级别, 已知的比如 www.quora.com 是tornado, gtalk不知道如何实现, 可能是java?
mochimedia应该比较erlang
国内的腾讯阿里什么的就更不知道了, 他们都有做web chat的, zhihu.com也是tornado
http://segmentfault.com/q/10100000001...
我用socket.io解决了实时消息的问题。
Microsoft ASP.NET SignalR

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

Running Python code in Notepad requires the Python executable and NppExec plug-in to be installed. After installing Python and adding PATH to it, configure the command "python" and the parameter "{CURRENT_DIRECTORY}{FILE_NAME}" in the NppExec plug-in to run Python code in Notepad through the shortcut key "F6".

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.
