如何在Springboot应用程序中配置Web套接字

时间:2019-05-29 12:29:07

标签: spring-batch spring-websocket

我看到了配置Web套接字的步骤,但是配置Message Broker()方法已被弃用,还有另一种配置Web套接字的方法

我覆盖了configure Message Broker()方法,但由于现在已弃用,它显示了错误。

   @Configuration
   @EnableWebSocketMessageBroker
public class WebSocketConfiguration implements WebSocketMessageBrokerConfigurer{

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/livedemo").withSockJS();}

    @Override
    public void configureMessageBroker(MessageBrokerRegistry registry){
           registry.enableStompBrokerRelay("/topic")
            .setRelayPort(1234)
            .setClientLogin("client-user")
            .setClientPasscode("client-password")
            .setSystemLogin("sys-user")
            .setSystemPasscode("sys-password");
            registry.setApplicationDestinationPrefixes("/app");
    }              
}

0 个答案:

没有答案