简体   繁体   中英

Real time web update client to client

I'm so curious real time web application like Facebook uses (eg. Friends Notifications) My question is what particular javascript code or existing framework I can use if theres any existing out there. Regards

Also have a look at websockets.

A description: http://www.html5rocks.com/en/tutorials/websockets/basics/

And a framework to use: http://socket.io/

That technique called as server push.Among them Comet is widley used and for PHP

Pusher – Who I work for-

Here is the real time list

Messaging: with focus on delivery to clients (eg Web Browsers)

The easiest way to access this technology is to use a framework. We have used http://www.pusher.com in some projects with good results.

This project is very nice, too:

http://socketo.me/

and its pure php

也看看这个它的长轮询它非常简单,但它不比socket.io更好.http://www.screenr.com/SNH

There is http://www.asp.net/signalr , it uses the best service for the connection, eg If websocket is available, then it'll use websocket, othwerwise it will use other techniques like polling (the worst technique).

Another one is http://nodejs.org/ , I don't know how it works, but it seems a good option. I think it uses websocket too.

Facebook Friends Notifications uses push technology.

Push, or server push, describes a style of Internet-based communication where the request for a given transaction is initiated by the publisher or central server. It is contrasted with pull, where the request for the transmission of information is initiated by the receiver or client.

You can read more about the way it works technically using Comet following this link.

Another solution is AngularJS ( http://anuglarjs.org ). This is a newer technology developed by someone within Google and seems to hold many promises in web application development.

Meteor JS也是一个很好的实时更新库。

I would advice you to use setinterval() in JS, and an ajax function to check if there are new messages in your database (not seen by the current user), if so show them as new. PP: you'll need to get to know some jquery and php, but overall creating it yourself gives you all the flexibility and a lot easier bug fixing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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