我建立了一个非常标准的SpringBoot WebSockets项目。
@Configuration
@EnableWebSocketMessageBroker
class WebSocketConfig : AbstractWebSocketMessageBrokerConfigurer() {
override fun configureMessageBroker(config: MessageBrokerRegistry) {
config.setApplicationDestinationPrefixes("/app")
.enableSimpleBroker("/topic")
}
override fun registerStompEndpoints(registry: StompEndpointRegistry) {
registry.addEndpoint("/offer")
}
}
当我试图用Java Stomp客户端连接到WebSocket时,我在控制台得到了这个。
Handshake failed due to unsupported WebSocket version: 8. Supported versions: [13]
因此,我无法连接或做任何事情... ...
谁能帮帮我?它已经1周,因为我开始围绕这个错误的斗争。
谢谢大家!我建立了一个非常标准的SpringBoot客户端。
由于时间有限,我最终没有使用STOMP作为子协议,而是只使用WebSocket。不过还是使用Spring。