Server Side Broadcasts OR Communication from Server Sides OR Non Http initiated Broadcast - Atmosphere/atmosphere Wiki

Once an AtmosphereResource gets suspended, you can initiate server push (or broadcast) at any moment. For example, the following code will broadcast every 10 seconds to all AtmosphereResource associated with the /* broadcaster:


       @Inject BroadcasterFactory factory;


       // Broadcaster periodically
        factory.lookup("/*").scheduleFixedBroadcast(
          new Callable<String>() {
            private int count =0;
            @Override
            public String call() throws Exception {
                return " Server Push " + count++;
            }
        }, 10, TimeUnit.SECONDS)

See on how to get the BroadcasterFactory