Class WebsocketPushContext

java.lang.Object
com.sun.faces.push.WebsocketPushContext
All Implemented Interfaces:
PushContext, Serializable

public class WebsocketPushContext
extends Object
implements PushContext

This is a concrete implementation of PushContext interface which is to be injected by @Push.

Since:
2.3
Author:
Bauke Scholtz
See Also:
Push, Serialized Form
  • Constructor Details

  • Method Details

    • send

      public Set<Future<Void>> send​(Object message)
      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 interface PushContext
      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 on Future.get() if the message was successfully delivered and otherwise throw ExecutionException.
      See Also:
      RemoteEndpoint.Async.sendText(String)
    • send

      public <S extends Serializable> Set<Future<Void>> send​(Object message, S user)
      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 interface PushContext
      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 on Future.get() if the message was successfully delivered and otherwise throw ExecutionException.
      See Also:
      RemoteEndpoint.Async.sendText(String)
    • send

      public <S extends Serializable> Map<S,​Set<Future<Void>>> send​(Object message, Collection<S> users)
      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 interface PushContext
      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 on Future.get() if the message was successfully delivered and otherwise throw ExecutionException.
      See Also:
      RemoteEndpoint.Async.sendText(String)