public interface PushContext
extends java.io.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.
@Inject @Push private PushContext channelName;
For detailed usage instructions, see @
Push
javadoc.
Push
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ENABLE_WEBSOCKET_ENDPOINT_PARAM_NAME
The boolean context parameter name to explicitly enable web socket endpoint during startup.
|
static java.lang.String |
URI_PREFIX
The context-relative web socket URI prefix where the endpoint should listen on.
|
static java.lang.String |
WEBSOCKET_ENDPOINT_PORT_PARAM_NAME
The integer context parameter name to specify the websocket endpoint port when it's different from HTTP port.
|
Modifier and Type | Method and Description |
---|---|
java.util.Set<java.util.concurrent.Future<java.lang.Void>> |
send(java.lang.Object message)
Send given message object to the push socket channel as identified by
@ Push . |
<S extends java.io.Serializable> |
send(java.lang.Object message,
java.util.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 java.io.Serializable> |
send(java.lang.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 <f:websocket user> . |
static final java.lang.String ENABLE_WEBSOCKET_ENDPOINT_PARAM_NAME
static final java.lang.String WEBSOCKET_ENDPOINT_PORT_PARAM_NAME
static final java.lang.String URI_PREFIX
java.util.Set<java.util.concurrent.Future<java.lang.Void>> send(java.lang.Object message)
@
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>
.message
- The push message object.null
on Future.get()
if the message was successfully delivered and otherwise throw ExecutionException
.java.lang.IllegalArgumentException
- If given message object cannot be encoded as JSON.RemoteEndpoint.Async.sendText(String)
<S extends java.io.Serializable> java.util.Set<java.util.concurrent.Future<java.lang.Void>> send(java.lang.Object message, S user)
@
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>
.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
.java.lang.IllegalArgumentException
- If given message object cannot be encoded as JSON.RemoteEndpoint.Async.sendText(String)
<S extends java.io.Serializable> java.util.Map<S,java.util.Set<java.util.concurrent.Future<java.lang.Void>>> send(java.lang.Object message, java.util.Collection<S> users)
@
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>
.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
.java.lang.IllegalArgumentException
- If given message object cannot be encoded as JSON.RemoteEndpoint.Async.sendText(String)