Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.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
具有SSL证书的Websocket(Spring)连接_Spring_Ssl Certificate_Spring Websocket - Fatal编程技术网

具有SSL证书的Websocket(Spring)连接

具有SSL证书的Websocket(Spring)连接,spring,ssl-certificate,spring-websocket,Spring,Ssl Certificate,Spring Websocket,我无法连接到需要Java中SSL证书的WebSocket。 在没有风暴的情况下,如何在春季使用Websockets 我已经用Python编写了以下代码,其想法是用Java编写同样的代码: @staticmethod async def connect() -> WebSocketClientProtocol: """ This routine connects to the specified URI

我无法连接到需要Java中SSL证书的WebSocket。 在没有风暴的情况下,如何在春季使用Websockets

我已经用Python编写了以下代码,其想法是用Java编写同样的代码:

    @staticmethod
    async def connect() -> WebSocketClientProtocol:
        """
        This routine connects to the specified URI
        and returns the web socket connection object
        """
        path = Commons.CERTIFICATE_PATH
        ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
        localhost_pem = pathlib.Path(__file__).resolve().parent / path
        ssl_context.load_verify_locations(localhost_pem)
        uri = EnvVars.URI
        try:
            ws = await websockets.connect(uri,
                                          ssl=ssl_context,
                                          ping_interval=3)
        except Exception as e:
            raise WebSocketConnectionError(e)
        else:
            logging.info(Messages.WEB_SOCKET_CONNECTED)
            return ws
如果可能,您将如何使用WebFlux