类 DefaultSimpUserRegistry
- java.lang.Object
- org.springframework.web.socket.messaging.DefaultSimpUserRegistry
- 所有已实现的接口:
EventListener
,ApplicationListener<ApplicationEvent>
,SmartApplicationListener
,Ordered
,SimpUserRegistry
public class DefaultSimpUserRegistry extends Object implements SimpUserRegistry, SmartApplicationListener
A default implementation ofSimpUserRegistry
that relies onAbstractSubProtocolEvent
application context events to keep track of connected users and their subscriptions.- 从以下版本开始:
- 4.2
- 作者:
- Rossen Stoyanchev
字段概要
从接口继承的字段 org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
构造器概要
构造器 构造器 说明 DefaultSimpUserRegistry()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Set<SimpSubscription>
findSubscriptions(SimpSubscriptionMatcher matcher)
Find subscriptions with the given matcher.int
getOrder()
Determine this listener's order in a set of listeners for the same event.SimpUser
getUser(String userName)
Get the user for the given name.int
getUserCount()
Return the count of all connected users.Set<SimpUser>
getUsers()
Return a snapshot of all connected users.void
onApplicationEvent(ApplicationEvent event)
Handle an application event.void
setOrder(int order)
Specify the order value for this registry.boolean
supportsEventType(Class<? extends ApplicationEvent> eventType)
Determine whether this listener actually supports the given event type.boolean
supportsSourceType(Class<?> sourceType)
Determine whether this listener actually supports the given source type.String
toString()
构造器详细资料
DefaultSimpUserRegistry
public DefaultSimpUserRegistry()
方法详细资料
setOrder
public void setOrder(int order)
Specify the order value for this registry.Default is
Ordered.LOWEST_PRECEDENCE
.- 从以下版本开始:
- 5.0.8
getOrder
public int getOrder()
从接口复制的说明:SmartApplicationListener
Determine this listener's order in a set of listeners for the same event.The default implementation returns
Ordered.LOWEST_PRECEDENCE
.- 指定者:
getOrder
在接口中Ordered
- 指定者:
getOrder
在接口中SmartApplicationListener
- 返回:
- the order value
- 另请参阅:
Ordered.HIGHEST_PRECEDENCE
,Ordered.LOWEST_PRECEDENCE
supportsEventType
public boolean supportsEventType(Class<? extends ApplicationEvent> eventType)
从接口复制的说明:SmartApplicationListener
Determine whether this listener actually supports the given event type.- 指定者:
supportsEventType
在接口中SmartApplicationListener
- 参数:
eventType
- the event type (nevernull
)
onApplicationEvent
public void onApplicationEvent(ApplicationEvent event)
从接口复制的说明:ApplicationListener
Handle an application event.- 指定者:
onApplicationEvent
在接口中ApplicationListener<ApplicationEvent>
- 参数:
event
- the event to respond to
supportsSourceType
public boolean supportsSourceType(@Nullable Class<?> sourceType)
从接口复制的说明:SmartApplicationListener
Determine whether this listener actually supports the given source type.The default implementation always returns
true
.- 指定者:
supportsSourceType
在接口中SmartApplicationListener
- 参数:
sourceType
- the source type, ornull
if no source
getUser
@Nullable public SimpUser getUser(String userName)
从接口复制的说明:SimpUserRegistry
Get the user for the given name.- 指定者:
getUser
在接口中SimpUserRegistry
- 参数:
userName
- the name of the user to look up- 返回:
- the user, or
null
if not connected
getUsers
public Set<SimpUser> getUsers()
从接口复制的说明:SimpUserRegistry
Return a snapshot of all connected users.The returned set is a copy and will not reflect further changes.
- 指定者:
getUsers
在接口中SimpUserRegistry
- 返回:
- the connected users, or an empty set if none
getUserCount
public int getUserCount()
从接口复制的说明:SimpUserRegistry
Return the count of all connected users.- 指定者:
getUserCount
在接口中SimpUserRegistry
- 返回:
- the number of connected users
findSubscriptions
public Set<SimpSubscription> findSubscriptions(SimpSubscriptionMatcher matcher)
从接口复制的说明:SimpUserRegistry
Find subscriptions with the given matcher.- 指定者:
findSubscriptions
在接口中SimpUserRegistry
- 参数:
matcher
- the matcher to use- 返回:
- a set of matching subscriptions, or an empty set if none