java.lang.Object
com.sun.faces.push.WebsocketSessionManager
This web socket session manager holds all web socket sessions by their channel identifier.
- Since:
- 2.3
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
On open, add given web socket session to the mapping associated with its channel identifier and returnstrue
if it's accepted (i.e.protected void
deregister
(Iterable<String> channelIds) Deregister given channel identifiers and explicitly close all open web socket sessions associated with it.protected void
Register given channel identifiers.protected void
Register given channel identifier.protected void
remove
(Session session, CloseReason reason) On close, remove given web socket session from the mapping.Encode the given message object as JSON and send it to all open web socket sessions associated with given web socket channel identifier.
-
Constructor Details
-
WebsocketSessionManager
public WebsocketSessionManager()
-
-
Method Details
-
register
Register given channel identifier.- Parameters:
channelId
- The channel identifier to register.
-
register
-
add
On open, add given web socket session to the mapping associated with its channel identifier and returnstrue
if it's accepted (i.e. the channel identifier is known) and the same session hasn't been added before, otherwisefalse
.- Parameters:
session
- The opened web socket session.- Returns:
true
if given web socket session is accepted and is new, otherwisefalse
.
-
send
Encode the given message object as JSON and send it to all open web socket sessions associated with given web socket channel identifier.- Parameters:
channelId
- The web socket channel identifier.message
- The push message string.- 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 return
null
onFuture.get()
if the message was successfully delivered and otherwise throwExecutionException
.
-
remove
On close, remove given web socket session from the mapping.- Parameters:
session
- The closed web socket session.reason
- The close reason.
-
deregister
-