java.lang.Object
org.omnifaces.cdi.push.SocketPushContext
- All Implemented Interfaces:
Serializable,PushContext
This is a concrete web socket implementation of PushContext interface which is to be injected by
@Push.
- Since:
- 2.3
- Author:
- Bauke Scholtz
- See Also:
-
Field Summary
Fields inherited from interface org.omnifaces.cdi.PushContext
SOCKET_URI_PREFIX, SSE_URI_PREFIX, URI_PREFIX -
Method Summary
Modifier and TypeMethodDescriptionSend given message object to the push 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 channel as identified by@Push, targeted to the given users as identified by<o:socket user>or<o:sse user>.<S extends Serializable>
Set<Future<Void>> Send given message object to the push channel as identified by@Push, targeted to the given user as identified by<o:socket user>or<o:sse user>.
-
Method Details
-
send
Description copied from interface:PushContextSend given message object to the push 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<o:socket onmessage>or<o:sse onmessage>.- Specified by:
sendin 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 session associated
with given push channel. The returned futures will return
nullonFuture.get()if the message was successfully delivered and otherwise throwExecutionException. - See Also:
-
send
Description copied from interface:PushContextSend given message object to the push channel as identified by@Push, targeted to the given user as identified by<o:socket user>or<o:sse user>. The message object will be encoded as JSON and be available as first argument of the JavaScript listener function declared in<o:socket onmessage>or<o:sse onmessage>.- Specified by:
sendin 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 session associated
with given push channel and user. The returned futures will return
nullonFuture.get()if the message was successfully delivered and otherwise throwExecutionException. - See Also:
-
send
Description copied from interface:PushContextSend given message object to the push channel as identified by@Push, targeted to the given users as identified by<o:socket user>or<o:sse user>. The message object will be encoded as JSON and be available as first argument of the JavaScript listener function declared in<o:socket onmessage>or<o:sse onmessage>.- Specified by:
sendin 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
session associated with given push channel and user. The returned futures will return
nullonFuture.get()if the message was successfully delivered and otherwise throwExecutionException. - See Also:
-