org.apache.wicket.protocol.ws.api.registry
Class SimpleWebSocketConnectionRegistry

java.lang.Object
  extended by org.apache.wicket.protocol.ws.api.registry.SimpleWebSocketConnectionRegistry
All Implemented Interfaces:
IWebSocketConnectionRegistry

public class SimpleWebSocketConnectionRegistry
extends Object
implements IWebSocketConnectionRegistry

A registry that keeps all currently opened web socket connections in maps in Application's meta data. TODO remove the synchronizations below and use ConcurrentMap#putIfAbsent()

Since:
6.0

Constructor Summary
SimpleWebSocketConnectionRegistry()
           
 
Method Summary
 IWebSocketConnection getConnection(Application application, String sessionId, IKey key)
           
 Collection<IWebSocketConnection> getConnections(Application application)
          Returns a collection of currently active websockets.
 void removeConnection(Application application, String sessionId, IKey key)
          Removes a web socket connection from the registry at the specified coordinates (application+session+page)
 void setConnection(Application application, String sessionId, IKey key, IWebSocketConnection connection)
          Adds a new connection into the registry at the specified coordinates (application+session+page)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleWebSocketConnectionRegistry

public SimpleWebSocketConnectionRegistry()
Method Detail

getConnection

public IWebSocketConnection getConnection(Application application,
                                          String sessionId,
                                          IKey key)
Specified by:
getConnection in interface IWebSocketConnectionRegistry
Parameters:
application - the web application to look in
sessionId - the web socket client session id
key - the web socket client key
Returns:
the web socket connection used by a client from the specified coordinates

getConnections

public Collection<IWebSocketConnection> getConnections(Application application)
Returns a collection of currently active websockets. The connections might close at any time.

Specified by:
getConnections in interface IWebSocketConnectionRegistry
Parameters:
application -
Returns:

setConnection

public void setConnection(Application application,
                          String sessionId,
                          IKey key,
                          IWebSocketConnection connection)
Description copied from interface: IWebSocketConnectionRegistry
Adds a new connection into the registry at the specified coordinates (application+session+page)

Specified by:
setConnection in interface IWebSocketConnectionRegistry
Parameters:
application - the web application to look in
sessionId - the web socket client session id
key - the web socket client key
connection - the web socket connection to add

removeConnection

public void removeConnection(Application application,
                             String sessionId,
                             IKey key)
Description copied from interface: IWebSocketConnectionRegistry
Removes a web socket connection from the registry at the specified coordinates (application+session+page)

Specified by:
removeConnection in interface IWebSocketConnectionRegistry
Parameters:
application - the web application to look in
sessionId - the web socket client session id
key - the web socket client key


Copyright © 2006–2020 Apache Software Foundation. All rights reserved.