Class WebSocketMessageBrokerConfiguration

java.lang.Object
org.springframework.session.web.socket.config.annotation.AbstractSessionWebSocketMessageBrokerConfigurer<org.springframework.session.Session>
cn.herodotus.engine.message.websocket.configuration.WebSocketMessageBrokerConfiguration
All Implemented Interfaces:
org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer

@Configuration(proxyBeanMethods=false) @EnableConfigurationProperties(WebSocketProperties.class) @EnableScheduling @EnableWebSocketMessageBroker public class WebSocketMessageBrokerConfiguration extends org.springframework.session.web.socket.config.annotation.AbstractSessionWebSocketMessageBrokerConfigurer<org.springframework.session.Session>

Description: WebSocketMessageBrokerConfigurer

Author:
: gengwei.zheng
Date:
: 2022/12/4 19:19
  • Constructor Summary

    Constructors
    Constructor
    Description
    WebSocketMessageBrokerConfiguration(WebSocketProperties webSocketProperties, WebSocketAuthenticationHandshakeInterceptor webSocketAuthenticationHandshakeInterceptor)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    configureClientInboundChannel(org.springframework.messaging.simp.config.ChannelRegistration registration)
    采用自定义拦截器,获取connect时候传递的参数 设置输入消息通道的线程数,默认线程为1,可以自己自定义线程数,最大线程数,线程存活时间
    void
    configureClientOutboundChannel(org.springframework.messaging.simp.config.ChannelRegistration registration)
    设置输出消息通道的线程数,默认线程为1,可以自己自定义线程数,最大线程数,线程存活时间
    void
    configureMessageBroker(org.springframework.messaging.simp.config.MessageBrokerRegistry registry)
    配置消息代理
    protected void
    configureStompEndpoints(org.springframework.web.socket.config.annotation.StompEndpointRegistry registry)
    添加 Stomp Endpoint,创建配置客户端尝试连接地址,并对外暴露该接口,这样就可以通过websocket连接上服务
    void
    configureWebSocketTransport(org.springframework.web.socket.config.annotation.WebSocketTransportRegistration registration)
    配置发送与接收的消息参数,可以指定消息字节大小,缓存大小,发送超时时间
    void
     

    Methods inherited from class org.springframework.session.web.socket.config.annotation.AbstractSessionWebSocketMessageBrokerConfigurer

    registerStompEndpoints, sessionRepositoryInterceptor, webSocketRegistryListener, wsConnectHandlerDecoratorFactory

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer

    addArgumentResolvers, addReturnValueHandlers, configureMessageConverters, getPhase
  • Constructor Details

  • Method Details

    • postConstruct

      @PostConstruct public void postConstruct()
    • configureStompEndpoints

      protected void configureStompEndpoints(org.springframework.web.socket.config.annotation.StompEndpointRegistry registry)
      添加 Stomp Endpoint,创建配置客户端尝试连接地址,并对外暴露该接口,这样就可以通过websocket连接上服务
      Specified by:
      configureStompEndpoints in class org.springframework.session.web.socket.config.annotation.AbstractSessionWebSocketMessageBrokerConfigurer<org.springframework.session.Session>
      Parameters:
      registry - StompEndpointRegistry
    • configureMessageBroker

      public void configureMessageBroker(org.springframework.messaging.simp.config.MessageBrokerRegistry registry)
      配置消息代理
      Parameters:
      registry - MessageBrokerRegistry
    • configureWebSocketTransport

      public void configureWebSocketTransport(org.springframework.web.socket.config.annotation.WebSocketTransportRegistration registration)
      配置发送与接收的消息参数,可以指定消息字节大小,缓存大小,发送超时时间
      Specified by:
      configureWebSocketTransport in interface org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
      Overrides:
      configureWebSocketTransport in class org.springframework.session.web.socket.config.annotation.AbstractSessionWebSocketMessageBrokerConfigurer<org.springframework.session.Session>
      Parameters:
      registration - WebSocketTransportRegistration
    • configureClientInboundChannel

      public void configureClientInboundChannel(org.springframework.messaging.simp.config.ChannelRegistration registration)
      采用自定义拦截器,获取connect时候传递的参数 设置输入消息通道的线程数,默认线程为1,可以自己自定义线程数,最大线程数,线程存活时间
      Specified by:
      configureClientInboundChannel in interface org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
      Overrides:
      configureClientInboundChannel in class org.springframework.session.web.socket.config.annotation.AbstractSessionWebSocketMessageBrokerConfigurer<org.springframework.session.Session>
      Parameters:
      registration - ChannelRegistration
    • configureClientOutboundChannel

      public void configureClientOutboundChannel(org.springframework.messaging.simp.config.ChannelRegistration registration)
      设置输出消息通道的线程数,默认线程为1,可以自己自定义线程数,最大线程数,线程存活时间
      Parameters:
      registration - ChannelRegistration