Examples of broadcast()


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

     
      String topicId = broadcastMsg.getTopic();
      if (broadcasters.containsKey(topicId)) {
        Broadcaster bc = broadcasters.get(topicId);
        try {
          bc.broadcast(origMessage).get();
        } catch(Exception ex) {
          logger.error("Failed to broadcast message received over the JGroups cluster "+this.clusterName, ex);
        }
      }
     
View Full Code Here

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

        if (broadcaster == null) {
            response.setBody(Status.CLIENT_DISCONNECTED);
        } else {
            String callbackMethod = msg.getTo().getURI();
            Object[] body = msg.getBody();
            broadcaster.broadcast(callbackMethod + "($.secureEvalJSON('" + JSONUtil.encodeResponse(body[0]) + "'))");
            response.setBody(Status.OK);
        }
        return response;
    }
View Full Code Here

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

        boolean isVoidReturnType = operation.getOutputType().getLogical().isEmpty();
        if (!isVoidReturnType) {
            Object response = wire.invoke(operation, args);
            Broadcaster broadcaster = CometSessionManager.get(sessionId);
            if (broadcaster != null) {
                broadcaster.broadcast(callbackMethod + "($.secureEvalJSON('" + JSONUtil.encodeResponse(response)
                        + "'))");
            }
        } else {
            wire.invoke(operation, msg);
        }
View Full Code Here

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

        logger.info("BEGIN SimpleAction.openCometChannel()");
        Meteor m = Meteor.build(req, list, null);
        m.setBroadcaster(b);
        req.getSession().setAttribute("meteor", m);
        m.suspend(-1);
        m.broadcast(req.getServerName()
                + "__has suspended a connection from " + req.getRemoteAddr());
        return null;
    }

    public ActionForward sendCometMsg(ActionMapping mapping, ActionForm _form, HttpServletRequest req, HttpServletResponse res) throws Exception {
View Full Code Here

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

        logger.info("meteor: " + m);
        res.setCharacterEncoding("UTF-8");
        String value = req.getParameter("value");
        logger.debug("value: " + value);

        m.broadcast("<script>parent.cometMsg('Broadcast: " + value + "');</script>");
        res.getWriter().write("{message:'success'}");
        res.getWriter().flush();
        return null;
    }
}
View Full Code Here

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

        public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
            final Meteor m = Meteor.build(req);
            req.getSession().setAttribute("meteor", m);
            m.suspend(5000, false);
           
            m.broadcast("resume");
            m.addListener(new AtmosphereResourceEventListener(){

                @Override
                public void onSuspend(final AtmosphereResourceEvent<HttpServletRequest, HttpServletResponse> event){
                }
View Full Code Here

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

        req.getSession().setAttribute("meteor", m);

        res.setContentType("text/html;charset=ISO-8859-1");

        m.suspend(-1);
        m.broadcast(req.getServerName() + "__has suspended a connection from " + req.getRemoteAddr());
    }

    /**
     * Re-use the {@link Meteor} created onthe first GET for broadcasting message.
     *
 
View Full Code Here

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

        String action = req.getParameterValues("action")[0];
        String name = req.getParameterValues("name")[0];

        if ("login".equals(action)) {
            req.getSession().setAttribute("name", name);
            m.broadcast("System Message from " + req.getServerName() + "__" + name + " has joined.");
            res.getWriter().write("success");
            res.getWriter().flush();
        } else if ("post".equals(action)) {
            String message = req.getParameterValues("message")[0];
            m.broadcast(name + "__" + message);
View Full Code Here

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

            m.broadcast("System Message from " + req.getServerName() + "__" + name + " has joined.");
            res.getWriter().write("success");
            res.getWriter().flush();
        } else if ("post".equals(action)) {
            String message = req.getParameterValues("message")[0];
            m.broadcast(name + "__" + message);
            res.getWriter().write("success");
            res.getWriter().flush();
        } else {
            res.setStatus(422);
View Full Code Here

Examples of org.atmosphere.util.SimpleBroadcaster.broadcast()

        b.getBroadcasterConfig().setBroadcasterCache(cache);
        // Reset
        b.removeAtmosphereResource(ar);

        b.addAtmosphereResource(ar);
        b.broadcast("foo").get();

        ar.close();
        b.removeAtmosphereResource(ar);

        b.broadcast("raide").get();
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.