public class UserEventMessenger extends Object
EventMessenger that has additional methods that allow a sender to send
EventMessage to a given username in addition to a WebSocket session id.
This class is not registered by default. See AbstractUserWampConfigurer for
configuration.AbstractUserWampConfigurer,
EventMessenger| Constructor and Description |
|---|
UserEventMessenger(EventMessenger eventMessenger,
org.springframework.messaging.simp.user.SimpUserRegistry simpUserRegistry) |
| Modifier and Type | Method and Description |
|---|---|
void |
send(EventMessage eventMessage) |
void |
sendDirect(EventMessage eventMessage) |
void |
sendTo(String topicURI,
Object event,
Set<String> eligibleSessionIds) |
void |
sendTo(String topicURI,
Object event,
String eligibleSessionId) |
void |
sendToAll(String topicURI,
Object event) |
void |
sendToAllExcept(String topicURI,
Object event,
Set<String> excludeSessionIds) |
void |
sendToAllExcept(String topicURI,
Object event,
String excludeSessionId) |
void |
sendToAllExceptUser(String topicURI,
Object event,
String excludeUser)
Send an
EventMessage to every client that is currently subscribed to the
provided topicURI except the one provided with the excludeUser parameter. |
void |
sendToAllExceptUsers(String topicURI,
Object event,
Set<String> excludeUsers)
Send an
EventMessage to every client that is currently subscribed to the
provided topicURI except the ones listed in the excludeUsers set. |
void |
sendToDirect(String topicURI,
Object event,
Set<String> webSocketSessionIds) |
void |
sendToDirect(String topicURI,
Object event,
String webSocketSessionId) |
void |
sendToUser(String topicURI,
Object event,
String eligibleUser)
Send an
EventMessage to one client that is subscribed to the given
topicURI. |
void |
sendToUserDirect(String topicURI,
Object event,
String user)
Send an EventMessage directly to the client specified with the user parameter.
|
void |
sendToUsers(String topicURI,
Object event,
Set<String> eligibleUsers)
Send an
EventMessage to every client that is currently subscribed to the
given topicURI and are listed in the eligibleUsers set. |
void |
sendToUsersDirect(String topicURI,
Object event,
Set<String> users)
Send an EventMessage directly to each client listed in the users set parameter.
|
void |
setSendTimeout(long sendTimeout) |
public UserEventMessenger(EventMessenger eventMessenger, org.springframework.messaging.simp.user.SimpUserRegistry simpUserRegistry)
public void setSendTimeout(long sendTimeout)
public void send(EventMessage eventMessage)
public void sendToAllExcept(String topicURI, Object event, Set<String> excludeSessionIds)
public void sendToDirect(String topicURI, Object event, Set<String> webSocketSessionIds)
public void sendDirect(EventMessage eventMessage)
public void sendToAllExceptUser(String topicURI, Object event, String excludeUser)
EventMessage to every client that is currently subscribed to the
provided topicURI except the one provided with the excludeUser parameter.topicURI - the name of the topicevent - the payload of the EventMessageuser - the user that will be excludedpublic void sendToAllExceptUsers(String topicURI, Object event, Set<String> excludeUsers)
EventMessage to every client that is currently subscribed to the
provided topicURI except the ones listed in the excludeUsers set.topicURI - the name of the topicevent - the payload of the EventMessageexcludeUsers - a set of users that will be excluded. If null or empty no user
will be excluded.public void sendToUsers(String topicURI, Object event, Set<String> eligibleUsers)
EventMessage to every client that is currently subscribed to the
given topicURI and are listed in the eligibleUsers set. If no user of the provided
set is subscribed to the topicURI nothing happens.topicURI - the name of the topicevent - the payload of the EventMessageeligibleUsers - only the users listed here will receive the EVENT message. If
null or empty nobody receives the message.public void sendToUser(String topicURI, Object event, String eligibleUser)
EventMessage to one client that is subscribed to the given
topicURI. If the client with the given user name is not subscribed to the topicURI
nothing happens.topicURI - the name of the topicevent - the payload of the EventMessageeligibleUser - only the user listed here will receive the messagepublic void sendToUsersDirect(String topicURI, Object event, Set<String> users)
SimpUserRegistry for his
username.
In contrast to sendToUsers(String, Object, Set) this method does not check
if the receivers are subscribed to the destination. The
SimpleBrokerMessageHandler is not involved in sending these messages.
topicURI - the name of the topicevent - the payload of the EventMessageusers - list of receivers for the EVENT messagepublic void sendToUserDirect(String topicURI, Object event, String user)
SimpUserRegistry for this user nothing happens.
In contrast to sendToUser(String, Object, String) this method does not
check if the receiver is subscribed to the destination. The
SimpleBrokerMessageHandler is not involved in sending this message.
topicURI - the name of the topicevent - the payload of the EventMessageuser - receiver of the EVENT messageCopyright © 2014–2017. All rights reserved.