Integrating Orbited with Web App Frameworks

September 7th, 2008 by Adrian Weisberg

The simplest Orbited architecture is to have Orbited proxying messages between the TCP server and the browser using socket connections. Many people, however, choose to use web application frameworks like Django or Ruby on Rails because they helpfully abstract away certain cumbersome tasks. You can easily connect Orbited and frameworks using message queue brokers, and the 0.7 release will feature an integrated basic broker.

Prior to 0.5, Orbited used a custom protocol (the Orbit protocol) for communication between it and the framework. Inside Orbited was a rudimentary message queue. This is the method used in the outdated CherryChat tutorial.

Integrated Orbit Protocol MQ Architecture

Use Existing Solutions

With 0.5, the team decided to switch to a standard and well-developed protocol: STOMP. Instead of trying to improve the message queue functionality, we decided to focus on TCPSocket and Comet. Using STOMP allows the use of advanced stand-alone message queue brokers like ActiveMQ and RabbitMQ. It also removes the need to write and update clients for the custom Orbit protocol, since there are actively maintained STOMP clients in many languages. These benefits are similar to the benefits of the biggest change in 0.5: TCPSocket, which lets you use existing protocols for communication to the browser.

Stand-Alone STOMP MQ Architecture

The Super-Easy Way

ActiveMQ and RabbitMQ are fairly easy to install and use, but many people wanted something even easier and simpler for testing and basic deployments. Starting with 0.7, Orbited will feature a built-in basic STOMP message queue. The message queue has already been released as a Twisted-based daemon called Morbid. If you have setuptools installed, type easy_install morbid and then run orbited and morbid. Go into the Stomp demo and it should work! Once Orbited 0.7 is released you won’t even have to install Morbid.

Integrated STOMP MQ Architecture

The Benefits in Two Sentences

With the integrated STOMP message queue, you can use the same architecture as with pre-0.5 but with the added benefits of using a standard protocol. Using a stand-alone STOMP message queue broker gives you the benefits of the standard protocol plus the features and performance of advanced message queue brokers.

7 Responses to “Integrating Orbited with Web App Frameworks”

  1. Ben Tremblay Says:

    Thanks for the confirmation.

    On Twitter someone brought up Comet/Orbited. I admitted harkening back to Netscape’s efforts with push (’97? ‘98?) and suggested to him that cough it calls for more design than most folk can manage.

    I tried the chat. Demo? With a right side-bar full of names that serves to list and nothing else? passive? un-linked? sterile? fallow? (What was I saying about design? I must have been ranting.)

    And the first thing I read when I come to the blog:

    “… choose to use web application frameworks like Django or Ruby on Rails …

    I say tomato, you say Ruby … I say potato, someone sez .NET.

    Meh … while editing hurricane wiki links I came up with the notion for a QRSS digital mode for ham radio. That sounds like fun. This sounds like self-inflicted injury.

    May God have mercy on your souls May you encounter happiness free from the root of suffering.

    -VA- –bentrem

  2. Fraggle Says:

    Hi,

    It seems that ActiveMQ is not well suited to handle thousands of consumers at the same time. Do you recommend anything until 0.7 is released? (my needs are very simple: just a “activity” notification will be done thru “comet” - no persistence of message) However, we need to handle thousands of connexions established simultaneously (5k - 10k).

    Thanks!

  3. Adrian Weisberg Says:

    Fraggle: Try RabbitMQ (http://www.rabbitmq.com/). Also, you said “until 0.7 is released,” so be aware that Morbid (the MQ that will be integrated into Orbited in 0.7) isn’t scalable and was built for development and small deployments. The demands you’re talking require a more high-performance solution like RabbitMQ. Let us know how it works out.

  4. Comet Daily » Blog Archive » Integrating Orbited with Web App Frameworks Says:

    [...] Weisberg recently wrote about various patterns of integrating Orbited and a web framework. We’ve been doing a lot of work to move towards direct integration with message queues as the [...]

  5. Orbited Blog » Blog Archive » Django + Orbited 0.6.x Tutorial Says:

    [...] that this uses a different technique than the STOMP method I described. Dark Porter takes advantage of the fact that Django and Orbited are both written in [...]

  6. RIA Revolution » Integrating Orbited with Web App Frameworks Says:

    [...] Weisberg on the “Orbited” blog wrote about Orbited integration with web frameworks. Orbited in its forthcoming 0.7 version will smoothly integrate with web frameworks using message [...]

  7. Nick Says:

    I just keep shaking my head in amazement with every new thing I learn about Orbited.

    I tried this in built STOMP thingy with Orbited 0.7.0 and I am truly blown away. Absolutely fantastic.

Leave a Reply