WebSocket connections cannot be established on edge or chrome but only on safari. what is wrong with my browser?

48 views Asked by At

java code with spring boot starter websocket @Configuration @EnableWebSocket public class WsConfig implements WebSocketConfigurer { @Autowired UserWsHandler userWsHandler; @Autowired UserHandlerShakeHandler userHandlerShakeHandler; @Override public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { registry.addHandler(userWsHandler,"/loginWs") .setAllowedOriginPatterns("*"); } js . const ws = new WebSocket("ws://10.12.36.178:8080/loginWs")

i got a EOFException when use chrome or edge.

Is something wrong with my code or my browser settings?

appreciates~

1

There are 1 answers

0
Steven Linus On

i am so stupid!

when use header 'Sec-Websocket-Protocol', the server must send back the same header.....