Examples of ServerChannel


Examples of org.cometd.bayeux.server.ServerChannel

  @Override
  public <EventType> void publish(final IPushChannel<EventType> pushChannel, final EventType event)
  {
    if (pushChannel instanceof CometdPushChannel)
    {
      final ServerChannel channel = _getBayeuxServerChannel((CometdPushChannel<?>)pushChannel);
      if (channel == null)
        LOG.warn("No cometd channel found for {}", pushChannel);
      else
      {
        final PushChannelState state = _channelStates.get(pushChannel);
        if (state == null)
          return;

        synchronized (state.queuedEventsLock)
        {
          state.queuedEvents.add(event);
        }

        channel.publish(null, "pollEvents", state.channel.getCometdChannelEventId());
      }
    }
    else
      LOG.warn("Unsupported push channel type {}", pushChannel);
  }
View Full Code Here

Examples of org.cometd.bayeux.server.ServerChannel

   * an additional Wicket AJAX request roundtrip.
   */
  public <EventType> void publishJavascript(final CometdPushChannel<EventType> pushChannel,
      final String javascript)
  {
    final ServerChannel channel = _getBayeuxServerChannel(pushChannel);
    if (channel == null)
      LOG.warn("No cometd channel found for {}", pushChannel);
    else
      channel.publish(null, "javascript:" + javascript, pushChannel.getCometdChannelEventId());
  }
View Full Code Here

Examples of org.cometd.bayeux.server.ServerChannel

    for (final IPushNode<?> pnode : pnodes)
    {
      @SuppressWarnings("unchecked")
      final CometdPushNode<EventType> node = (CometdPushNode<EventType>)pnode;

      final ServerChannel cchannel = _getBayeuxServerChannel(node);
      if (cchannel == null)
      {
        LOG.warn("No cometd channel found for {}", node);
        continue;
      }

      @SuppressWarnings("unchecked")
      final PushNodeState<EventType> state = (PushNodeState<EventType>)_nodeStates.get(node);
      if (state != null)
      {
        synchronized (state.queuedEventsLock)
        {
          state.queuedEvents.add(ctx);
        }
        cchannel.publish(null, "pollEvents", state.node.getCometdChannelEventId());
      }
    }
  }
View Full Code Here

Examples of org.cometd.bayeux.server.ServerChannel

  @Override
  public <EventType> void publish(final IPushNode<EventType> node, final EventType event)
  {
    if (node instanceof CometdPushNode)
    {
      final ServerChannel cchannel = _getBayeuxServerChannel((CometdPushNode<?>)node);
      if (cchannel == null)
        LOG.warn("No cometd channel found for {}", node);
      else
      {
        @SuppressWarnings("unchecked")
        final PushNodeState<EventType> state = (PushNodeState<EventType>)_nodeStates.get(node);
        if (state != null)
        {
          synchronized (state.queuedEventsLock)
          {
            state.queuedEvents.add(new CometdPushEventContext<EventType>(event, null,
              this));
          }
          cchannel.publish(null, "pollEvents", state.node.getCometdChannelEventId());
        }
      }
    }
    else
      LOG.warn("Unsupported push node type {}", node);
View Full Code Here

Examples of org.cometd.bayeux.server.ServerChannel

   * AJAX request roundtrip.
   */
  public <EventType> void publishJavascript(final CometdPushNode<EventType> node,
    final String javascript)
  {
    final ServerChannel channel = _getBayeuxServerChannel(node);
    if (channel == null)
      LOG.warn("No cometd channel found for {}", node);
    else
      channel.publish(null, "javascript:" + javascript, node.getCometdChannelEventId());
  }
View Full Code Here

Examples of org.cometd.bayeux.server.ServerChannel

            exchange.setIn(message);

            consumer.getProcessor().process(exchange);

            if (ExchangeHelper.isOutCapable(exchange)) {
                ServerChannel channel = getBayeux().getChannel(channelName);
                ServerSession serverSession = getServerSession();

                ServerMessage.Mutable outMessage = binding.createCometdMessage(channel, serverSession, exchange.getOut());
                remote.deliver(serverSession, outMessage);
            }
View Full Code Here

Examples of org.cometd.bayeux.server.ServerChannel

    if (null == broker)
      throw new IOException("no broker to handle this service " + serviceName);

    HashMap<String, Object> data = new HashMap<String, Object>();
    data.put("error", true);
    ServerChannel ch = broker.getResponseChannel();
    client.deliver(broker.getServer(), ch.getId(), data, null);
  }
View Full Code Here

Examples of org.cometd.bayeux.server.ServerChannel

    };

    String rosterUnavailableChannel =
            this.sessionHandler.getRosterUnavailableChannel();
    server.createIfAbsent(rosterUnavailableChannel, initializer);
    ServerChannel channel = server.getChannel(rosterUnavailableChannel);
    if (channel == null) {
      return;
    }

    ServerSession from = this.sessionManager.getServerSession();

    Integer siteId = (Integer) client.getAttribute("siteid");
    String username = (String) client.getAttribute("username");

    Map<String, Object> data = new HashMap<String, Object>();
    data.put("siteId", siteId);
    data.put("username", username);

    log.fine(data.toString());

    channel.publish(from, data, null);
  }
View Full Code Here

Examples of org.cometd.bayeux.server.ServerChannel

    HashMap<String, Object> data = new HashMap<String, Object>();
    data.put("value", obj);
    data.put("error", false);

    ServerChannel channel = this.getResponseChannel();
    for (ServerSession client : this.subscribers) {
      client.deliver(this.server, channel.getId(), data, null);
    }
  }
View Full Code Here

Examples of org.cometd.bayeux.server.ServerChannel

  }

  public ServerChannel getResponseChannel() {

    String channelName = "/bot/" + this.serviceName;
    ServerChannel serverChannel = this.bayeuxServer.getChannel(channelName);
    if (serverChannel != null)
      return serverChannel;

    ServerChannel.Initializer initializer = new ServerChannel.Initializer()
    {
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.