如何在没有定义stomp websocket的情况下配置到websocket的url?

umuewwlo  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(268)

我有正在工作的stomp websocket终结点:

@Configuration
@EnableWebSocketMessageBroker
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class WebSocketServerConfig implements WebSocketMessageBrokerConfigurer {
...
    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("myStompEndpoint");
    }
...

并希望添加websocket端点而不必跺脚:

@Configuration
@EnableWebSocket
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class WsServerConfig implements WebSocketConfigurer {

    private final MyTextWsHandler myTextWsHandler;

    @Override
    public void registerWebSocketHandlers(WebSocketHandlerRegistry webSocketHandlerRegistry) {
        webSocketHandlerRegistry.addHandler(myTextWsHandler, "abcdef")
                .addInterceptors(myHandshakeInterceptor());
    }
}

现在stomp websocket的url是: ws://localhost:8080/myStompEndpoint . 没有跺脚的websocket的url是什么?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题