Class WebSocketPushBroadcaster
- java.lang.Object
-
- org.apache.wicket.protocol.ws.api.WebSocketPushBroadcaster
-
public class WebSocketPushBroadcaster extends Object
Allows pushing events for processing to Pages that have active web sockets.- Since:
- 6.4
- Author:
- Mikko Tiihonen
-
-
Constructor Summary
Constructors Constructor Description WebSocketPushBroadcaster(IWebSocketConnectionRegistry registry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
broadcast(ConnectedMessage connection, IWebSocketPushMessage message)
Processes the given message in the page and session identified by the given Web Socket connection.void
broadcastAll(Application application, IWebSocketPushMessage message)
Processes the given message in all pages that have active Web Socket connections.void
broadcastAllInSession(Application application, String sessionId, IWebSocketPushMessage message)
Processes the given message in all pages in a given session that have active Web Socket connections.void
broadcastAllMatchingFilter(Application application, IWebSocketConnectionRegistry.IConnectionsFilter connectionsFilter, IWebSocketPushMessage message)
Processes the given message in all pages in a given session that have active Web Socket connections and match the given filter.
-
-
-
Constructor Detail
-
WebSocketPushBroadcaster
public WebSocketPushBroadcaster(IWebSocketConnectionRegistry registry)
-
-
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. UseWebSocketSettings.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 sessionmessage
- The push message event
-
broadcastAll
public void broadcastAll(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. UseWebSocketSettings.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 applicationmessage
- The push message event
-
broadcastAllInSession
public void broadcastAllInSession(Application application, String sessionId, IWebSocketPushMessage message)
Processes the given message in all pages in a given session 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. UseWebSocketSettings.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 applicationsessionId
- The session IDmessage
- The push message event
-
broadcastAllMatchingFilter
public void broadcastAllMatchingFilter(Application application, IWebSocketConnectionRegistry.IConnectionsFilter connectionsFilter, IWebSocketPushMessage message)
Processes the given message in all pages in a given session that have active Web Socket connections and match the given filter. 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. UseWebSocketSettings.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 applicationconnectionsFilter
- theIWebSocketConnectionRegistry.IConnectionsFilter
message
- The push message event
-
-