我看到了配置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");
}
}