Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot Websocket:意外响应代码:302_Spring Boot_Websocket - Fatal编程技术网

Spring boot Websocket:意外响应代码:302

Spring boot Websocket:意外响应代码:302,spring-boot,websocket,Spring Boot,Websocket,创建websocket连接时,我遇到以下异常: VM74253:149 WebSocket connection to 'wss://HerokuAppName.herokuapp.com/connect2Deploy' failed: Error during WebSocket handshake: Unexpected response code: 302 websocket的弹簧启动代码: @Configuration @EnableWebSocket public class Web

创建websocket连接时,我遇到以下异常:

VM74253:149 WebSocket connection to 'wss://HerokuAppName.herokuapp.com/connect2Deploy' failed: Error during WebSocket handshake: Unexpected response code: 302
websocket的弹簧启动代码:

@Configuration
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {
    public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
        registry.addHandler(new SocketHandler(), "/connect2Deploy");
    }
}
Sockethandler类只有会话详细信息,因为我只希望会话详细信息将服务器详细信息发送到UI,不会有任何客户端到服务器的通信

@Component
public class SocketHandler extends TextWebSocketHandler {

    public WebSocketSession sessions = null;

    @Override
    public void afterConnectionEstablished(WebSocketSession session) throws Exception {
        //the messages will be broadcasted to all users.
        sessions = session;
    }

    public WebSocketSession getSessions() {
        return sessions;
    }
}
但在websocket握手过程中,它总是抛出
错误,我是不是遗漏了什么