use of org.apache.wicket.protocol.ws.api.IWebSocketConnection in project wicket by apache.
the class SimpleWebSocketConnectionRegistry method getConnection.
@Override
public IWebSocketConnection getConnection(Application application, String sessionId, IKey key) {
Args.notNull(application, "application");
Args.notNull(sessionId, "sessionId");
Args.notNull(key, "key");
IWebSocketConnection connection = null;
ConcurrentMap<String, ConcurrentMap<IKey, IWebSocketConnection>> connectionsBySession = application.getMetaData(KEY);
if (connectionsBySession != null) {
ConcurrentMap<IKey, IWebSocketConnection> connectionsByPage = connectionsBySession.get(sessionId);
if (connectionsByPage != null) {
connection = connectionsByPage.get(key);
}
}
return connection;
}
use of org.apache.wicket.protocol.ws.api.IWebSocketConnection in project openmeetings by apache.
the class WebSocketHelper method sendClient.
private static void sendClient(IWsClient client, Consumer<IWebSocketConnection> wsc) {
Application app = (Application) getApp();
WebSocketSettings settings = WebSocketSettings.Holder.get(app);
IWebSocketConnectionRegistry reg = settings.getConnectionRegistry();
// FIXME TODO
Executor executor = settings.getWebSocketPushMessageExecutor();
final IWebSocketConnection wc = reg.getConnection(app, client.getSessionId(), new PageIdKey(client.getPageId()));
if (wc != null && wc.isOpen()) {
executor.run(() -> {
wsc.accept(wc);
});
}
}
Aggregations