Examples of broadcast()


Examples of org.atmosphere.cpr.Broadcaster.broadcast()

                }
            }

            //Simple Broadcast
            bc.getBroadcasterConfig().addFilter(new XSSHtmlFilter());
            Future<String> f = bc.broadcast(event.getAtmosphereConfig().getWebServerName()
                    + "**has suspended a connection from "
                    + req.getRemoteAddr());

            try {
                // Wait for the push to occurs. This is blocking a thread as the Broadcast operation
View Full Code Here

Examples of org.atmosphere.cpr.Broadcaster.broadcast()

                    return;
                }
               
                session.setAttribute("name", name);
               
                myBroadcasterFollower.broadcast(BEGIN_SCRIPT_TAG
                        + toJsonp("Welcome back", name)
                        + END_SCRIPT_TAG);

                // Store the Broadcaster associated with this user so
                // we can retrieve it for supporting follower.
View Full Code Here

Examples of org.atmosphere.cpr.Broadcaster.broadcast()

                if (callback == null) {
                    callback = "alert";
                }

                if (myBroadcasterFollower != null){
                    myBroadcasterFollower.broadcast("<script id='comet_" + counter++ + "'>"
                            + "window.parent." + callback + "(" + message + ");</script>");
                } else {
                    throw new RuntimeException("Broadcaster was null");
                }
                response.getWriter().println("ok");
View Full Code Here

Examples of org.atmosphere.cpr.Broadcaster.broadcast()

               
                myBroadcasterFollower.broadcast(BEGIN_SCRIPT_TAG
                        + toJsonp("You are now following ", follow)
                        + END_SCRIPT_TAG, r);
               
                outsiderBroadcaster.broadcast(BEGIN_SCRIPT_TAG
                        + toJsonp(name, " is now following " + follow)
                        + END_SCRIPT_TAG);
            }
        }
    }
View Full Code Here

Examples of org.atmosphere.cpr.Broadcaster.broadcast()

        if (req.getMethod().equalsIgnoreCase("GET")) {
            event.suspend();

            Broadcaster bc = event.getBroadcaster();
            bc.getBroadcasterConfig().addFilter(new XSSHtmlFilter());
            bc.broadcast(event.getAtmosphereConfig().getWebServerName()
                    + "**has suspended a connection from "
                    + req.getRemoteAddr());
        } else if (req.getMethod().equalsIgnoreCase("POST")) {
            res.setCharacterEncoding("UTF-8");
            String action = req.getParameterValues("action")[0];
View Full Code Here

Examples of org.atmosphere.cpr.Broadcaster.broadcast()

        listener.submit(new Runnable() {
            public void run() {
                jedisSubscriber.subscribe(new JedisPubSub() {
                    public void onMessage(String channel, String message) {
                        receivedMessages.offer(message);
                        broadcaster.broadcast(message);
                    }

                    public void onSubscribe(String channel, int subscribedChannels) {
                        logger.debug("onSubscribe(): channel: {}", channel);
                    }
View Full Code Here

Examples of org.atmosphere.cpr.Broadcaster.broadcast()

                currentTime = System.currentTimeMillis();
                event.suspend(5000, false);
                try {
                Broadcaster b = BroadcasterFactory.getDefault().lookup(DefaultBroadcaster.class, "ExternalBroadcaster", true);
                b.addAtmosphereResource(event);
                b.broadcast("Outer broadcast").get();


                    event.getBroadcaster().broadcast("Inner broadcast").get();
                } catch (InterruptedException e) {
                    e.printStackTrace();
View Full Code Here

Examples of org.atmosphere.cpr.Broadcaster.broadcast()

                try {
                    r.setEntity(msg);
                    if (msg == null) return;

                    if (delay == -1) {
                        Future<Object> f = b.broadcast(msg);
                        if (f == null) return;
                        Object t = f.get();
                        if (o instanceof Broadcastable) {
                            r.setEntity(returnMsg);
                        }
View Full Code Here

Examples of org.atmosphere.cpr.Broadcaster.broadcast()

        addFilter(broadcaster, filters, clusterBroadcastFilters);
        if (msg == null) return view;

        if (delay == -1) {
            broadcaster.broadcast(msg);
        } else if (delay == 0) {
            broadcaster.delayBroadcast(msg);
        } else {
            broadcaster.delayBroadcast(msg, delay, TimeUnit.SECONDS);
        }
View Full Code Here

Examples of org.atmosphere.cpr.Broadcaster.broadcast()

    public void broadcastsClusteredMessage() throws Exception {
        Broadcaster broadcaster = mock(Broadcaster.class);
        Future broadcastedMessage = mock(Future.class);
       
        when(broadcaster.getID()).thenReturn("/topic");
        when(broadcaster.broadcast("message")).thenReturn(broadcastedMessage);
       
        JChannel channel1 = new JChannel();
        JChannel channel2 = new JChannel();
       
        channel1.getProtocolStack().insertProtocolAtTop(new FLUSH());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.