/** * @param from the session from which the message originates * @param data the data of the message * @deprecated use {@link #publish(Session, Object, Promise)} instead */ @Deprecated default void publish(Session from, Object data) { publish(from, data, Promise.noop()); }
/** * @param from the session from which the message originates * @param message the message to publish * @deprecated use {@link #publish(Session, ServerMessage.Mutable, Promise)} instead */ @Deprecated default void publish(Session from, ServerMessage.Mutable message) { publish(from, message, Promise.noop()); }
/** * Directly sends JavaScript code to the node via a cometd channel without an additional Wicket * 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()); }
/** * {@inheritDoc} */ @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); }
cchannel.publish(null, "pollEvents", state.node.getCometdChannelEventId());
@Override public void run() { for (SystemTopics topic : SystemTopics.values()) { String topicData; switch (topic) { case Time: topicData = logDateFormat.format(new Date()); break; default: topicData = "unknown topic: " + topic.toString(); } ServerMessage.Mutable message = bayeuxServer.newMessage(); message.setChannel(channels.get(topic.ordinal()).getId()); message.setData(topicData); channels.get(topic.ordinal()).publish(session, message); } } }