Browse files

Readme tweaks.

  • Loading branch information...
1 parent b519177 commit c3a5880dc198ede24a54a0531d35f23f7ec5f485 @benzenwen benzenwen committed Mar 23, 2012
Showing with 71 additions and 9 deletions.
  1. +71 −9
@@ -1,11 +1,73 @@
# Tractor Push
-This is a demonstration of a client that accepts two message
-streams from a server asynchronously. The left box updates on the
-arrival of the 'all messages' stream: simple, array, or complex. The
-right box updates from a message stream of only 'complex' type. The
-streams are independent but draw from the same source.
+#A Real-time Demo with Ruby, Node.js, and MongoDB on Heroku Cedar
+Learn how to use three rising infrastructure technologies that put
+real-time interactivity into Web apps: ``, `Node.js` and
+`MongoDB`. Real-time interactivity examples include chat, large-scale
+games, editing collaboration, and low-latency notification. In a
+market with dynamic, mobile, and social applications, a strong Web
+interface is still an important component to the entire experience.
+To demonstrate cross-app functionality with an existing Ruby
+application, the article first walks through using a separate Heroku
+app to write to a shared MongoDB acting as a simple queue.
+Fortuitously, Heroku’s new Celadon Cedar stack offers several features
+that support these techniques: a polyglot stack and flexible worker
+dynos that connect to arbitrary queuing systems.
+<p class="callout" markdown="1"> Part I code:
+<a href=""></a></p>
+<p class="callout" markdown="1"> Part II code:
+<a href=""></a></p>
+## Overview
+<img src="" width="822" height="401" alt="Overview of TractorPush components."/>
+In the rest of the article, you
+* create the database,
+* connect a writer in Ruby,
+* connect a reader in Node.js,
+* instruct a browser to connect over
+First, create a MongoDB collection on MongoLab that serves as a simple
+but flexible message queue. The Ruby application writes documents to
+the collection, and a Node.js application reads the documents on
+demand. The read query in Node.js is initiated by a browser request.
+The query returns a tailable cursor to read documents as they arrive.
+Additionally, the browser negotiates a XHR-long polling process to
+simulate a push of documents to the browser. In effect, the entire
+stack, from database to browser presentation works in a push
+notification manner.
+<p class="callout" markdown="1">As of this writing, Heroku does not
+support the newer true push WebSocket protocol. XHR-long polling works acceptably. </p>
+<img src="" width="841" height="563" alt="End user screenshot of TractorPush demo."/>
+From an end user perspective, a browser window updates as existing
+messages are sent. Once the existing messages are exhausted, the
+browser window is static until new messages arrive at the server. As
+they arrive, the browser window continues to update. For the
+impatient: shows the running
+Given MongoDB's schema-free design, our messages can be arbitrarily
+complex JSON. In this demonstration to show the flexibility of the
+object marshalling and unmarshalling, there are three types of
+document-based messages that are pushed through the system:
+* simple (name-value),
+* array,
+* complex (nested documents).
+To demonstrate filtering of the different types of messages on the
+queue, one area of the screen shows all types of messages: with their
+sequence number and time of creation. In a second side of the screen,
+only complex-type messages are shown.
+# Running instance
A running version of the demo is at:
The server is node.js running It reads from a capped
@@ -23,8 +85,8 @@ MongoLab. See and https://github
See: (TODO: URL) for detailed instructions on how to run the demo, but succintly:
* Create a mongodb database 'testdatabase' with a capped collection 'messages' on localhost OR use Heroku and create a MONGOLAB database.
-* Run tractorpush-inserter-ruby to insert files
-* Run 'npm install' Run tractorpush-server (this project): 'node.js app.js'
+* Run tractorpush-writer-ruby to insert files
+* Run 'npm install' Run tractorpush-server (this project): 'node app.js'
* Point your browser to http://localhost:2000 and enjoy
# Inserter Ruby

0 comments on commit c3a5880

Please sign in to comment.