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
ConstructorsConstructorDescriptionWebSocketMessageBrokerConfiguration(WebSocketProperties webSocketProperties, WebSocketAuthenticationHandshakeInterceptor webSocketAuthenticationHandshakeInterceptor) -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigureClientInboundChannel(org.springframework.messaging.simp.config.ChannelRegistration registration) 采用自定义拦截器,获取connect时候传递的参数 设置输入消息通道的线程数,默认线程为1,可以自己自定义线程数,最大线程数,线程存活时间voidconfigureClientOutboundChannel(org.springframework.messaging.simp.config.ChannelRegistration registration) 设置输出消息通道的线程数,默认线程为1,可以自己自定义线程数,最大线程数,线程存活时间voidconfigureMessageBroker(org.springframework.messaging.simp.config.MessageBrokerRegistry registry) 配置消息代理protected voidconfigureStompEndpoints(org.springframework.web.socket.config.annotation.StompEndpointRegistry registry) 添加 Stomp Endpoint,创建配置客户端尝试连接地址,并对外暴露该接口,这样就可以通过websocket连接上服务voidconfigureWebSocketTransport(org.springframework.web.socket.config.annotation.WebSocketTransportRegistration registration) 配置发送与接收的消息参数,可以指定消息字节大小,缓存大小,发送超时时间voidMethods inherited from class org.springframework.session.web.socket.config.annotation.AbstractSessionWebSocketMessageBrokerConfigurer
registerStompEndpoints, sessionRepositoryInterceptor, webSocketRegistryListener, wsConnectHandlerDecoratorFactoryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
addArgumentResolvers, addReturnValueHandlers, configureMessageConverters, getPhase
-
Constructor Details
-
WebSocketMessageBrokerConfiguration
public WebSocketMessageBrokerConfiguration(WebSocketProperties webSocketProperties, WebSocketAuthenticationHandshakeInterceptor webSocketAuthenticationHandshakeInterceptor)
-
-
Method Details
-
postConstruct
@PostConstruct public void postConstruct() -
configureStompEndpoints
protected void configureStompEndpoints(org.springframework.web.socket.config.annotation.StompEndpointRegistry registry) 添加 Stomp Endpoint,创建配置客户端尝试连接地址,并对外暴露该接口,这样就可以通过websocket连接上服务- Specified by:
configureStompEndpointsin classorg.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:
configureWebSocketTransportin interfaceorg.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer- Overrides:
configureWebSocketTransportin classorg.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:
configureClientInboundChannelin interfaceorg.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer- Overrides:
configureClientInboundChannelin classorg.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
-