public class SocketPushContext extends Object implements PushContext
This is a concrete implementation of PushContext
interface which is to be injected by
@
Push
.
Push
,
Serialized FormURI_PREFIX
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> . |
public Set<Future<Void>> send(Object message)
PushContext
@
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>
.send
in interface PushContext
message
- The push message object.null
on Future.get()
if the message was successfully delivered and otherwise throw ExecutionException
.Json.encode(Object)
,
RemoteEndpoint.Async.sendText(String)
public <S extends Serializable> Set<Future<Void>> send(Object message, S user)
PushContext
@
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>
.send
in interface PushContext
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
.Json.encode(Object)
,
RemoteEndpoint.Async.sendText(String)
public <S extends Serializable> Map<S,Set<Future<Void>>> send(Object message, Collection<S> users)
PushContext
@
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>
.send
in interface PushContext
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
.Json.encode(Object)
,
RemoteEndpoint.Async.sendText(String)
Copyright © 2012–2018 OmniFaces. All rights reserved.