java.lang.Object
com.sun.faces.push.WebsocketPushContext
- All Implemented Interfaces:
PushContext
,Serializable
This is a concrete implementation of PushContext
interface which is to be injected by
@
Push
.
- Since:
- 2.3
- See Also:
-
Field Summary
Fields inherited from interface jakarta.faces.push.PushContext
ENABLE_WEBSOCKET_ENDPOINT_PARAM_NAME, URI_PREFIX, WEBSOCKET_ENDPOINT_PORT_PARAM_NAME
-
Constructor Summary
ConstructorDescriptionWebsocketPushContext
(String channel, WebsocketSessionManager socketSessions, WebsocketUserManager socketUsers) Creates a socket push context whereby the mutable map of session and view scope channel identifiers is referenced, so it's still available when another thread invokessend(Object)
during which the session and view scope is not necessarily active anymore. -
Method Summary
Modifier and TypeMethodDescriptionSend given message object to the push socket channel as identified by@
Push
.<S extends Serializable>
Map<S, Set<Future<Void>>> send
(Object message, Collection<S> users) Send given message object to the push socket channel as identified by@
Push
, targeted to the given users as identified by<f:websocket user>
.<S extends Serializable>
Set<Future<Void>> Send given message object to the push socket channel as identified by@
Push
, targeted to the given user as identified by<f:websocket user>
.
-
Constructor Details
-
WebsocketPushContext
public WebsocketPushContext(String channel, WebsocketSessionManager socketSessions, WebsocketUserManager socketUsers) Creates a socket push context whereby the mutable map of session and view scope channel identifiers is referenced, so it's still available when another thread invokessend(Object)
during which the session and view scope is not necessarily active anymore.
-
-
Method Details
-
send
Description copied from interface:PushContext
Send given message object to the push socket channel as identified by@
Push
. The message object will be encoded as JSON and be available as first argument of the JavaScript listener function declared in<f:websocket onmessage>
.- Specified by:
send
in interfacePushContext
- Parameters:
message
- The push message object.- Returns:
- The results of the send operation. If it returns an empty set, then there was no open web socket session
associated with given socket channel. The returned futures will return
null
onFuture.get()
if the message was successfully delivered and otherwise throwExecutionException
. - See Also:
-
send
Description copied from interface:PushContext
Send given message object to the push socket channel as identified by@
Push
, targeted to the given user as identified by<f:websocket user>
. The message object will be encoded as JSON and be available as first argument of the JavaScript listener function declared in<f:websocket onmessage>
.- Specified by:
send
in interfacePushContext
- Type Parameters:
S
- The generic type of the user identifier.- Parameters:
message
- The push message object.user
- The user to which the push message object must be delivered to.- Returns:
- The results of the send operation. If it returns an empty set, then there was no open web socket session
associated with given socket channel and user. The returned futures will return
null
onFuture.get()
if the message was successfully delivered and otherwise throwExecutionException
. - See Also:
-
send
Description copied from interface:PushContext
Send given message object to the push socket channel as identified by@
Push
, targeted to the given users as identified by<f:websocket user>
. The message object will be encoded as JSON and be available as first argument of the JavaScript listener function declared in<f:websocket onmessage>
.- Specified by:
send
in interfacePushContext
- Type Parameters:
S
- The generic type of the user identifier.- Parameters:
message
- The push message object.users
- The users to which the push message object must be delivered to.- Returns:
- The results of the send operation grouped by user. If it contains an empty set, then there was no open web
socket session associated with given socket channel and user. The returned futures will return
null
onFuture.get()
if the message was successfully delivered and otherwise throwExecutionException
. - See Also:
-