Class SocketPushContext

    • Method Detail

      • 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 <o:socket 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:
        Json.encode(Object), RemoteEndpoint.Async.sendText(String)
      • send

        public <S extends SerializableSet<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 <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>.
        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:
        Json.encode(Object), RemoteEndpoint.Async.sendText(String)
      • send

        public <S extends SerializableMap<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 <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>.
        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:
        Json.encode(Object), RemoteEndpoint.Async.sendText(String)