This web socket session manager holds all web socket sessions by their channel identifier.
Push
| Modifier and Type | Field and Description |
|---|---|
| private static volatile WebsocketSessionManager | |
| private static final CloseReason | |
| private static final AnnotationLiteral | |
| private static final AnnotationLiteral | |
| private final ConcurrentMap | |
| private WebsocketUserManager |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | Returns: true if given web socket session is accepted and is new, otherwise false.The opened web socket session. session)On open, add given web socket session to the mapping associated with its channel identifier and returns
|
| protected void | deregister(Iterable<String>
The channel identifiers to deregister. channelIds)Deregister given channel identifiers and explicitly close all open web socket sessions associated with it. |
| private static void | |
| private static String | |
| private static String | |
| pack-priv static WebsocketSessionManager | |
| protected void | |
| protected void | |
| protected void | remove(Session
The closed web socket session. session, CloseReason The close reason. reason)On close, remove given web socket session from the mapping. |
| protected Set | Returns: The results of the send operation. If it returns an empty set, then there was no open session associated with given channel identifier. The returned futures will returnnull on Future#get() if the
message was successfully delivered and otherwise throw ExecutionException.The web socket channel identifier. channelId, Object The push message object. message)Encode the given message object as JSON and send it to all open web socket sessions associated with given web socket channel identifier. |
| private void |
| instance | back to summary |
|---|---|
| private static volatile WebsocketSessionManager instance | |
| REASON_EXPIRED | back to summary |
|---|---|
| private static final CloseReason REASON_EXPIRED | |
| SESSION_CLOSED | back to summary |
|---|---|
| private static final AnnotationLiteral<WebsocketEvent. | |
| SESSION_OPENED | back to summary |
|---|---|
| private static final AnnotationLiteral<WebsocketEvent. | |
| socketSessions | back to summary |
|---|---|
| private final ConcurrentMap<String, Collection<Session>> socketSessions | |
| socketUsers | back to summary |
|---|---|
| private WebsocketUserManager socketUsers
| |
| WebsocketSessionManager | back to summary |
|---|---|
| public WebsocketSessionManager() | |
| add | back to summary |
|---|---|
| protected boolean add(Session session) On open, add given web socket session to the mapping associated with its channel identifier and returns
| |
| deregister | back to summary |
|---|---|
| protected void deregister(Iterable<String> channelIds) Deregister given channel identifiers and explicitly close all open web socket sessions associated with it. | |
| fireEvent | back to summary |
|---|---|
| private static void fireEvent(Session session, CloseReason reason, AnnotationLiteral<?> qualifier) | |
| getChannel | back to summary |
|---|---|
| private static String getChannel(Session session) | |
| getChannelId | back to summary |
|---|---|
| private static String getChannelId(Session session) | |
| getInstance | back to summary |
|---|---|
| pack-priv static WebsocketSessionManager getInstance() Internal usage only. Awkward workaround for it being unavailable via @Inject in endpoint in Tomcat+Weld/OWB. | |
| register | back to summary |
|---|---|
| protected void register(String channelId) Register given channel identifier.
| |
| register | back to summary |
|---|---|
| protected void register(Iterable<String> channelIds) Register given channel identifiers. | |
| remove | back to summary |
|---|---|
| protected void remove(Session session, CloseReason reason) On close, remove given web socket session from the mapping.
| |
| send | back to summary |
|---|---|
| protected Set Encode the given message object as JSON and send it to all open web socket sessions associated with given web socket channel identifier.
| |
| send | back to summary |
|---|---|
| private void send(Session session, String text, Set<Future<Void>> results) | |