ALL COVERED TOPICS

NoSQL Benchmarks NoSQL use cases NoSQL Videos NoSQL Hybrid Solutions NoSQL Presentations Big Data Hadoop MapReduce Pig Hive Flume Oozie Sqoop HDFS ZooKeeper Cascading Cascalog BigTable Cassandra HBase Hypertable Couchbase CouchDB MongoDB OrientDB RavenDB Jackrabbit Terrastore Amazon DynamoDB Redis Riak Project Voldemort Tokyo Cabinet Kyoto Cabinet memcached Amazon SimpleDB Datomic MemcacheDB M/DB GT.M Amazon Dynamo Dynomite Mnesia Yahoo! PNUTS/Sherpa Neo4j InfoGrid Sones GraphDB InfiniteGraph AllegroGraph MarkLogic Clustrix CouchDB Case Studies MongoDB Case Studies NoSQL at Adobe NoSQL at Facebook NoSQL at Twitter

NAVIGATE MAIN CATEGORIES

Close

Redis PUB/SUB Used for Real-time Collaborative Web Editing

Lakshan Perera implemented a real-time collaborative editor using Redis PUB/SUB support which will become available with Redis 2.0 announced for May 21st and currently available as RC1, Node.js[1] and web sockets[2]. Redis is also used for storing the documents in the app.

On each pad, there are different types of messages that users send on different events. These messages needs to be propagated correctly to other users.

Mainly following messages needs to be sent:

  • When a user joins a pad
  • When a user leaves a pad
  • When a user sends a diff
  • When a user sends a chat message

For handling the message delivery, I used Redis’ newly introduced pub/sub implementation. Every time a user is connected (i.e. visits a pad) there would be two redis client instances initiated for him. One client is used for publishing his messages, while other will be used to listen to incoming messages from subscribed channels.

Source code of the project can be found on ☞ GitHub and there’s also a short video demo of the app:

Just in case you are wondering about the Node.js-Redis combination, Michael Bleigh’s presentation below will detail some of the benefits of using the asynchronous model:

Last, but not least, I should say that Node.js usage is not at all common in the NoSQL world.

References

  • [1] ☞ Node.js: evented I/O for V8 javascript ()
  • [2] ☞ WebSocket API: enables web pages to use the WebSocket protocol for tw-way communication with a remote host. WebSockets is a real solution to problems that were previously solved using long-poll, comet, etc. ()

via: http://www.web2media.net/laktek/2010/05/25/real-time-collaborative-editing-with-websockets-node-js-redis/