congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
IWebSocketConnectionRegistry
Code IndexAdd Tabnine 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)

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 requests using okhttp
  • getContentResolver (Context)
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JFileChooser (javax.swing)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now