public interface PushContext extends Serializable
CDI interface to send a message object to the push socket channel as identified by @Push.
This can be injected via @Push in any container managed artifact in WAR (not in EAR/EJB!).
@Inject @Push private PushContext channelName;
For detailed usage instructions, see Socket javadoc.
Socket| Modifier and Type | Field and Description |
|---|---|
static String |
URI_PREFIX
The context-relative web socket URI prefix where the endpoint should listen on.
|
| Modifier and Type | Method and Description |
|---|---|
Set<Future<Void>> |
send(Object message)
Send given message object to the push socket channel as identified by
@Push. |
<S extends Serializable> |
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 <o:socket user>. |
<S extends Serializable> |
send(Object message,
S user)
Send given message object to the push socket channel as identified by
@Push, targeted
to the given user as identified by <o:socket user>. |
static final String URI_PREFIX
Set<Future<Void>> send(Object message)
@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>.message - The push message object.null on Future.get()
if the message was successfully delivered and otherwise throw ExecutionException.IllegalArgumentException - If given message object cannot be encoded as JSON.Json.encode(Object),
RemoteEndpoint.Async.sendText(String)<S extends Serializable> Set<Future<Void>> send(Object message, S user)
@Push, targeted
to the given user as identified by <o:socket 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>.S - The generic type of the user identifier.message - The push message object.user - The user to which the push message object must be delivered to.null on
Future.get() if the message was successfully delivered and otherwise throw ExecutionException.IllegalArgumentException - If given message object cannot be encoded as JSON.Json.encode(Object),
RemoteEndpoint.Async.sendText(String)<S extends Serializable> Map<S,Set<Future<Void>>> send(Object message, Collection<S> users)
@Push, targeted
to the given users as identified by <o:socket 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>.S - The generic type of the user identifier.message - The push message object.users - The users to which the push message object must be delivered to.null on Future.get() if the message was successfully delivered and otherwise throw
ExecutionException.IllegalArgumentException - If given message object cannot be encoded as JSON.Json.encode(Object),
RemoteEndpoint.Async.sendText(String)Copyright © 2012–2017 OmniFaces. All rights reserved.