Granite Data Services - Real-time Messaging (Comet/Servlet 3.0)

Real-time Messaging (Comet/Servlet 3.0)

Real-time messaging lets a Flex application publish to and receive from other clients data in so-called real-time. Messages may also be sent from the JavaEE server itself (known as data push), such as special alerts or progress events.

The implementation of real-time messaging in GraniteDS is based on the Comet model, now standardized in the Servlet 3.0 specification (JSR-303). Specifically, the transport protocol relies on a partial implementation of the standard Bayeux protocol.

On the server side, this implementation relies on specific servlet containers capabilities (such as Tomcat's CometProcessor or Jetty's Continuations) or on standardized Servlet 3.0 implementations when available. These implementations allow scalable real-time messaging by providing a way of releasing servlet threads when the HTTP connections are idle: the standard thread-per-connection model is replaced by a much more efficient thread-by-request model (see explanations in Jetty documentation).

GraniteDS uses a long polling model for managing HTTP requests between Flex client applications and the server: when a request for incoming data stays idle for a given amount of time (usually 30 s), it is closed and immediately reopened. This model prevents unexpected closing of idle HTTP connections traversing Internet proxies.

Real-time messaging with GraniteDS is based on a consumer–producer model and lets you define topics and subtopics for partitioning groups of messages. You may also filter topic's messages by using specific selectors.

Read more about this topic:  Granite Data Services