Codota Logo
IWebSocketConnectionRegistry
Code IndexAdd Codota to your IDE (free)

How to use
IWebSocketConnectionRegistry
in
org.apache.wicket.protocol.ws.api.registry

Best Java code snippets using org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry (Showing top 20 results out of 315)

  • Common ways to obtain IWebSocketConnectionRegistry
private void myMethod () {
IWebSocketConnectionRegistry i =
  • Codota IconWebSocketSettings webSocketSettings;webSocketSettings.getConnectionRegistry()
  • Smart code suggestions by Codota
}
origin: com.giffing.wicket.spring.boot.starter/wicket-spring-boot-starter

@Override
public void send(IWebSocketPushMessage event) {
  Application application = Application.get(WicketWebInitializer.WICKET_FILTERNAME);
  WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application);
  IWebSocketConnectionRegistry connectionRegistry = webSocketSettings.getConnectionRegistry();
  Collection<IWebSocketConnection> connections = connectionRegistry.getConnections(application);
  log.trace("sending event to {} connections", connections.size());
  for (IWebSocketConnection connection : connections) {
    connection.sendMessage(event);
  }
}
origin: org.apache.wicket/wicket-native-websocket-core

String sessionId = connection.getSessionId();
IKey key = connection.getKey();
IWebSocketConnection wsConnection = registry.getConnection(application, sessionId, key);
if (wsConnection == null)
origin: org.apache.wicket/wicket-native-websocket-core

@Override
public void onClose(int closeCode, String message)
{
  IKey key = getRegistryKey();
  broadcastMessage(new ClosedMessage(getApplication(), getSessionId(), key));
  connectionRegistry.removeConnection(getApplication(), getSessionId(), key);
}
origin: theonedev/onedev

/**
 * A helper that registers the opened connection in the application-level registry.
 *
 * @param connection
 *            the web socket connection to use to communicate with the client
 * @see #onOpen(Object)
 */
protected final void onConnect(final IWebSocketConnection connection) {
  IKey key = getRegistryKey();
  connectionRegistry.setConnection(getApplication(), getSessionId(), key, connection);
  if (connectionFilter != null)
  {
    ConnectionRejected connectionRejected = connectionFilter.doFilter(servletRequest);
    if (connectionRejected != null)
    {
      broadcastMessage(new AbortedMessage(getApplication(), getSessionId(), key));
      connectionRegistry.removeConnection(getApplication(), getSessionId(), key);
      connection.close(connectionRejected.getCode(), connectionRejected.getReason());
      return;
    }
  }
  broadcastMessage(new ConnectedMessage(getApplication(), getSessionId(), key));
}
origin: org.apache.wicket/wicket-native-websocket-core

/**
 * A helper that registers the opened connection in the application-level registry.
 *
 * @param connection
 *            the web socket connection to use to communicate with the client
 * @see #onOpen(Object)
 */
protected final void onConnect(final IWebSocketConnection connection) {
  IKey key = getRegistryKey();
  connectionRegistry.setConnection(getApplication(), getSessionId(), key, connection);
  if (connectionFilter != null)
  {
    ConnectionRejected connectionRejected = connectionFilter.doFilter(servletRequest);
    if (connectionRejected != null)
    {
      broadcastMessage(new AbortedMessage(getApplication(), getSessionId(), key));
      connectionRegistry.removeConnection(getApplication(), getSessionId(), key);
      connection.close(connectionRejected.getCode(), connectionRejected.getReason());
      return;
    }
  }
  broadcastMessage(new ConnectedMessage(getApplication(), getSessionId(), key));
}
origin: MarcGiffing/wicket-spring-boot

@Override
public void send(IWebSocketPushMessage event) {
  Application application = Application.get(WicketWebInitializer.WICKET_FILTERNAME);
  WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application);
  IWebSocketConnectionRegistry connectionRegistry = webSocketSettings.getConnectionRegistry();
  Collection<IWebSocketConnection> connections = connectionRegistry.getConnections(application);
  log.trace("sending event to {} connections", connections.size());
  for (IWebSocketConnection connection : connections) {
    connection.sendMessage(event);
  }
}
origin: apache/wicket

/**
 * A helper that registers the opened connection in the application-level registry.
 *
 * @param connection
 *            the web socket connection to use to communicate with the client
 * @see #onOpen(Object)
 */
protected final void onConnect(final IWebSocketConnection connection) {
  IKey key = getRegistryKey();
  connectionRegistry.setConnection(getApplication(), getSessionId(), key, connection);
  if (connectionFilter != null)
  {
    ConnectionRejected connectionRejected = connectionFilter.doFilter(servletRequest);
    if (connectionRejected != null)
    {
      broadcastMessage(new AbortedMessage(getApplication(), getSessionId(), key));
      connectionRegistry.removeConnection(getApplication(), getSessionId(), key);
      connection.close(connectionRejected.getCode(), connectionRejected.getReason());
      return;
    }
  }
  broadcastMessage(new ConnectedMessage(getApplication(), getSessionId(), key));
}
origin: apache/wicket

String sessionId = connection.getSessionId();
IKey key = connection.getKey();
IWebSocketConnection wsConnection = registry.getConnection(application, sessionId, key);
if (wsConnection == null)
origin: apache/wicket

@Override
public void onClose(int closeCode, String message)
{
  IKey key = getRegistryKey();
  broadcastMessage(new ClosedMessage(getApplication(), getSessionId(), key));
  connectionRegistry.removeConnection(getApplication(), getSessionId(), key);
}
origin: theonedev/onedev

@Override
public void run() {
  for (IWebSocketConnection connection: connectionRegistry.getConnections(application)) {
    PageKey pageKey = ((WebSocketConnection) connection).getPageKey();
    if (connection.isOpen() && (sourcePageKey == null || !sourcePageKey.equals(pageKey))) {
      Map<IKey, Collection<String>> sessionPages = observables.get(pageKey.getSessionId());
      if (sessionPages != null) {
        Collection<String> pageObservables = sessionPages.get(pageKey.getPageId());
        if (pageObservables != null && pageObservables.contains(observable)) {
          try {
            connection.sendMessage(OBSERVABLE_CHANGED + ":" + observable);
          } catch (IOException e) {
            throw new RuntimeException(e);
          }
        }
      }
    }
  }
}

origin: apache/wicket

IWebSocketConnection connection = connectionRegistry.getConnection(application, sessionId, key);
origin: theonedev/onedev

@Override
public void onClose(int closeCode, String message)
{
  IKey key = getRegistryKey();
  broadcastMessage(new ClosedMessage(getApplication(), getSessionId(), key));
  connectionRegistry.removeConnection(getApplication(), getSessionId(), key);
}
origin: apache/wicket

/**
 * 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
 * {@link 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.
 *
 * @param application
 *            The wicket application
 * @param message
 *            The push message event
 */
public void broadcastAll(Application application, IWebSocketPushMessage message)
{
  Args.notNull(application, "application");
  Args.notNull(message, "message");
  Collection<IWebSocketConnection> wsConnections = registry.getConnections(application);
  if (wsConnections == null)
  {
    return;
  }
  process(application, wsConnections, message);
}
origin: org.apache.wicket/wicket-native-websocket-core

IWebSocketConnection connection = connectionRegistry.getConnection(application, sessionId, key);
origin: org.apache.wicket/wicket-native-websocket-core

/**
 * 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
 * {@link 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.
 *
 * @param application
 *            The wicket application
 * @param message
 *            The push message event
 */
public void broadcastAll(Application application, IWebSocketPushMessage message)
{
  Args.notNull(application, "application");
  Args.notNull(message, "message");
  Collection<IWebSocketConnection> wsConnections = registry.getConnections(application);
  if (wsConnections == null)
  {
    return;
  }
  process(application, wsConnections, message);
}
origin: theonedev/onedev

IWebSocketConnection connection = connectionRegistry.getConnection(application, sessionId, key);
origin: org.wicketstuff/wicketstuff-whiteboard

/**
 * Load the documents list from the documents folder and synchronizing the list between whiteboard clients
 */
private void handleDocs() {
  loadDocuments();
  IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();
  for (IWebSocketConnection c : reg.getConnections(Application.get())) {
    try {
      JSONArray jsonArray = new JSONArray();
      Set<String> keySet = docMap.keySet();
      for (String key : keySet) {
        jsonArray.put(docMap.get(key).get(0));
      }
      c.sendMessage(getDocumentListMessage(jsonArray).toString());
    } catch (Exception e) {
      log.error("Unexpected error while sending message through the web socket", e);
    }
  }
}
origin: org.wicketstuff/wicketstuff-whiteboard

/**
 * Synchronizing eraseAll request between whiteboard clients
 * 
 * @return
 */
private boolean handleEraseAll() {
  elementMap.clear();
  IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();
  for (IWebSocketConnection c : reg.getConnections(Application.get())) {
    try {
      JSONArray jsonArray = new JSONArray();
      c.sendMessage(getEraseAllMessage(jsonArray).toString());
      return true;
    } catch (Exception e) {
      log.error("Unexpected error while sending message through the web socket", e);
    }
  }
  return false;
}
origin: org.wicketstuff/wicketstuff-whiteboard

/**
 * Load the components of a particular document from the documents folder and synchronizing the list between
 * whiteboard clients
 * 
 * @param docBaseName
 */
private void handleDocComponents(String docBaseName) {
  loadDocuments();
  IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();
  for (IWebSocketConnection c : reg.getConnections(Application.get())) {
    try {
      JSONArray jsonArray = new JSONArray();
      for (String url : docMap.get(docBaseName)) {
        jsonArray.put(url);
      }
      c.sendMessage(getDocumentComponentListMessage(jsonArray).toString());
    } catch (Exception e) {
      log.error("Unexpected error while sending message through the web socket", e);
    }
  }
}
origin: org.wicketstuff/wicketstuff-whiteboard

for (IWebSocketConnection c : reg.getConnections(Application.get())) {
  try {
    c.sendMessage(getUndoMessage(changeList, deleteList).toString());
for (IWebSocketConnection c : reg.getConnections(Application.get())) {
  try {
    if (previousBackground != null) {
org.apache.wicket.protocol.ws.api.registryIWebSocketConnectionRegistry

Javadoc

Tracks all currently connected WebSocket clients

Most used methods

  • getConnections
  • getConnection
  • removeConnection
    Removes a web socket connection from the registry at the specified coordinates (application+session+
  • setConnection
    Adds a new connection into the registry at the specified coordinates (application+session+page)

Popular in Java

  • Making http post requests using okhttp
  • getExternalFilesDir (Context)
  • requestLocationUpdates (LocationManager)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • BoxLayout (javax.swing)
  • Join (org.hibernate.mapping)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now