Class DefaultSimpUserRegistry

java.lang.Object
org.springframework.web.socket.messaging.DefaultSimpUserRegistry
All Implemented Interfaces:
EventListener, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>, org.springframework.context.event.SmartApplicationListener, org.springframework.core.Ordered, org.springframework.messaging.simp.user.SimpUserRegistry

public class DefaultSimpUserRegistry extends Object implements org.springframework.messaging.simp.user.SimpUserRegistry, org.springframework.context.event.SmartApplicationListener
A default implementation of SimpUserRegistry that relies on AbstractSubProtocolEvent application context events to keep track of connected users and their subscriptions.
Since:
4.2
Author:
Rossen Stoyanchev, Sam Brannen
  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Set<org.springframework.messaging.simp.user.SimpSubscription>
    findSubscriptions(org.springframework.messaging.simp.user.SimpSubscriptionMatcher matcher)
     
    int
     
    org.springframework.messaging.simp.user.SimpUser
    getUser(String userName)
     
    int
     
    Set<org.springframework.messaging.simp.user.SimpUser>
     
    void
    onApplicationEvent(org.springframework.context.ApplicationEvent event)
     
    void
    setOrder(int order)
    Specify the order value for this registry.
    boolean
    supportsEventType(Class<? extends org.springframework.context.ApplicationEvent> eventType)
     
    boolean
    supportsSourceType(Class<?> sourceType)
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.springframework.context.ApplicationListener

    supportsAsyncExecution

    Methods inherited from interface org.springframework.context.event.SmartApplicationListener

    getListenerId
  • Constructor Details

    • DefaultSimpUserRegistry

      public DefaultSimpUserRegistry()
  • Method Details

    • setOrder

      public void setOrder(int order)
      Specify the order value for this registry.

      Default is Ordered.LOWEST_PRECEDENCE.

      Since:
      5.0.8
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
      Specified by:
      getOrder in interface org.springframework.context.event.SmartApplicationListener
    • supportsEventType

      public boolean supportsEventType(Class<? extends org.springframework.context.ApplicationEvent> eventType)
      Specified by:
      supportsEventType in interface org.springframework.context.event.SmartApplicationListener
    • onApplicationEvent

      public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
      Specified by:
      onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
    • supportsSourceType

      public boolean supportsSourceType(@Nullable Class<?> sourceType)
      Specified by:
      supportsSourceType in interface org.springframework.context.event.SmartApplicationListener
    • getUser

      @Nullable public org.springframework.messaging.simp.user.SimpUser getUser(String userName)
      Specified by:
      getUser in interface org.springframework.messaging.simp.user.SimpUserRegistry
    • getUsers

      public Set<org.springframework.messaging.simp.user.SimpUser> getUsers()
      Specified by:
      getUsers in interface org.springframework.messaging.simp.user.SimpUserRegistry
    • getUserCount

      public int getUserCount()
      Specified by:
      getUserCount in interface org.springframework.messaging.simp.user.SimpUserRegistry
    • findSubscriptions

      public Set<org.springframework.messaging.simp.user.SimpSubscription> findSubscriptions(org.springframework.messaging.simp.user.SimpSubscriptionMatcher matcher)
      Specified by:
      findSubscriptions in interface org.springframework.messaging.simp.user.SimpUserRegistry
    • toString

      public String toString()
      Overrides:
      toString in class Object