Blog comet

Dojo WebSocket with AMD

By on November 5, 2012 12:23 pm

Dojo has an API for Comet-style real-time communication based on the WebSocket API. WebSocket provides a bi-directional connection to servers that is ideal for pushing messages from a server to a client in real-time. Dojo’s dojox/socket module provides access to this API with automated fallback to HTTP-based long-polling for browsers (or servers) that do not support the new WebSocket API. This allows you start using this API with Dojo now.

Real-time Updates with dgrid

By on September 24, 2012 10:46 am

The new dgrid is designed to work with object stores, which makes it easy to create grids that are driven by real-time updates. This is a great feature for rapidly changing data like stock prices or game scores.

To make a dgrid update in real-time, we just need to back it with a real-time object store. This can be accomplished by simply wrapping it with the Observable store wrapper. If we start with a JsonRest object store that retrieves data through REST calls, we can wrap that with Observable:

var stockStore = new Observable(new JsonRest({

Now our stockStore is real-time ready. Next we have to write some code to notify listeners of changes in data. Observable stores provide a notify() method that we can call to notify the store of changes in data. Typically, for a real-time application with rapidly changing data, we would create a Comet connection to a server, and as we receive data from the server, we could notify our store, which would automatically trigger updates in the grid. This might look something like:

// create a socket or long-polling connection to a server and then listen for messages
mySocket.on("message", function(message){
   // got a message   
   var data =;
   // assuming the data is the object to update, we can update the store with:

StockList: Real-time Business Analytics Using Dojo and Lightstreamer

By on April 4, 2011 12:06 am

The proliferation of online data gives businesses more information than they can possibly manage. Real-time dashboards and trading systems help users make sense of financial information, analytics, business trends, customer stats, and much more. The Dojo Toolkit and Lightstreamer are two popular choices available for building your own platforms and applications.

Building on a long-standing collaboration between SitePen and Lightstreamer (Weswit Srl), SitePen created the new LightstreamerStore. Based on the new Dojo Toolkit 1.6 Object Store API and the latest Lightstreamer preview releases, it is intended to make streaming data from a Lightstreamer server super-simple for developers. SitePen also updated the existing Lightstreamer + Dojo Toolkit demo to demonstrate this simplified interface. The demo visualizes the data returned in real-time from Lightstreamer using both the Dojo DataGrid and Dojo Charting. Charts display the “normalized last price” to more easily visualize changes in prices.

Many Comet Solutions for your Real-time Apps

By on January 3, 2011 12:01 am

We’ve been interested in Comet for a long time, dating back to the days of mod_pubsub and early talks on event-driven user interfaces. Now, with the arrival of WebSockets in WebKit-based browsers, and expected in Firefox 4.x and Internet Explorer 9 once the next WebSockets specification draft is completed, and with Comet techniques used by many of the world’s most popular sites, Comet has arrived as a viable necessity for rolling-out real-time capabilities for your web applications.