Live blogging system with JavaScript
I want to have sort of live blogging that will allow a reporter to live blog and add updates on-the-fly.
Wha开发者_高级运维t is the best way to do this? Check for updates every X seconds or use some kind of AJAX push?
Some examples:
- http://www.bbc.co.uk/news/world-middle-east-12307698
- http://thelede.blogs.nytimes.com/2011/03/11/video-of-the-earthquake-and-tsunami-in-japan/
I would definitely look at using WebSockets or some sort of push technology.
It depends on your level but you can either use a third party service like Pusher, use an open source project like Juggernaut or build your own.
If you're going to bake a solution yourself look at Node.js, EventMachine and Socket.IO. You'll also need some sort of capable pub/sub queuing system. Redis or RabbitMQ are perfect.
I feel Node.js and JavaScript are more suited to building a realtime push server but if you are more comfortable with Ruby EventMachine is also great.
I'd use Socket.IO for all solutions. Socket.IO basically uses WebSockets if your browser/mobile supports them and falls back to Flash, polling etc. It takes all the headache away involved with browsers and their lack of support for HTML5 features.
Personally I would use Juggernaut as that combines Socket.IO, Redis and Node.js which are the technologies I'd choose to build such a system. Juggernaut is readymade, straightforward to setup and easily scalable thanks to Node.js and Redis.
精彩评论