Class WebSocketPushBroadcaster


  • public class WebSocketPushBroadcaster
    extends java.lang.Object
    Allows pushing events for processing to Pages that have active web sockets.
    Since:
    6.4
    Author:
    Mikko Tiihonen
    • Method Detail

      • broadcast

        public void broadcast​(ConnectedMessage connection,
                              IWebSocketPushMessage message)
        Processes the given message in the page and session identified by the given Web Socket connection. The message is sent as an event to the Page and components of the session allowing the components to be updated. This method can be invoked from any thread, even a non-wicket thread. By default all processing is done in the caller thread. Use WebSocketSettings.setWebSocketPushMessageExecutor(org.apache.wicket.protocol.ws.concurrent.Executor) to move processing to background threads. If the given connection is no longer open then the broadcast is silently ignored.
        Parameters:
        connection - The Web Socket connection that identifies the page and session
        message - The push message event
      • broadcastAll

        public void broadcastAll​(org.apache.wicket.Application application,
                                 IWebSocketPushMessage message)
        Processes the given message in all pages that have active Web Socket connections. The message is sent as an event to the Page and components of the session allowing the components to be updated. This method can be invoked from any thread, even a non-wicket thread. By default all processing is done in the caller thread. Use WebSocketSettings.setWebSocketPushMessageExecutor(org.apache.wicket.protocol.ws.concurrent.Executor) to move processing to background threads. If some connections are not in valid state they are silently ignored.
        Parameters:
        application - The wicket application
        message - The push message event