Skip to content

Atmosphere Broadcaster

Lance edited this page Jan 11, 2014 · 5 revisions

The org.lazan.t5.atmosphere.services.AtmosphereBroadcaster is the serverside entry point for publishing messages to pushTargets. The AtmosphereBroadcaster can be injected into you serverside pages, components and services via Tapestry IOC.

You can publish any object as a message including simple Strings or complex custom objects. The message object will be delivered to each pushTarget that is subscribing to the topic. The message will fire the event specified by the pushTarget (the message object will be passed as the event context).

If the message type and the event context type differ, type coercion will occur.

eg

public class MyBroadcastingService {
   @Inject
   private AtmosphereBroadcaster broadcaster;

   public void doBroadcast() {
      MyMessageBean messageBean = new MyMessageBean("test message", new Date());
      broadcaster.broadcast("testTopic", messageBean);
   }
}
Clone this wiki locally