Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/133.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
Javascript Qt安全web套接字_Javascript_C++_Qt_Google Chrome Extension_Websocket - Fatal编程技术网

Javascript Qt安全web套接字

Javascript Qt安全web套接字,javascript,c++,qt,google-chrome-extension,websocket,Javascript,C++,Qt,Google Chrome Extension,Websocket,我正在开发一个Qt应用程序,它通过WebSocket与我的web浏览器(目前是Google Chrome)通信。我有一个Chrome扩展,它将javascript脚本注入一些网页(如youtube),并打开一个websocket到我的Qt应用程序: var websock = new WebSocket('ws://localhost:52132'); QSslSocket: cannot resolve TLSv1_1_client_method QSslSocket: cannot res

我正在开发一个Qt应用程序,它通过WebSocket与我的web浏览器(目前是Google Chrome)通信。我有一个Chrome扩展,它将javascript脚本注入一些网页(如youtube),并打开一个websocket到我的Qt应用程序:

var websock = new WebSocket('ws://localhost:52132');
QSslSocket: cannot resolve TLSv1_1_client_method
QSslSocket: cannot resolve TLSv1_2_client_method
QSslSocket: cannot resolve TLSv1_1_server_method
QSslSocket: cannot resolve TLSv1_2_server_method
QSslSocket: cannot resolve SSL_select_next_proto
QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
在Qt端,我有一个
QWebSocketServer

server = new QWebSocketServer("My Server", 
                              QWebSocketServer::SslMode::NonSecureMode, 
                              this) ;
connect(server, &QWebSocketServer::newConnection, 
        this, &MyWidget::onNewConnection) ;
以及
connection
插槽:

QWebSocket *socket = server->nextPendingConnection () ;
这不是确切的代码,但它目前正在工作。不幸的是,我无法在https页面上注入javascript,因为我使用的是不安全的WebSocket

因此,我尝试使用安全WebSocket,将
ws://localhost:52132
更改为
wss://localhost:52132
NonSecureMode
SecureMode
,但如果服务器在指定端口上成功启动,它也不工作

启动应用程序时,我从Qt获得以下信息:

var websock = new WebSocket('ws://localhost:52132');
QSslSocket: cannot resolve TLSv1_1_client_method
QSslSocket: cannot resolve TLSv1_2_client_method
QSslSocket: cannot resolve TLSv1_1_server_method
QSslSocket: cannot resolve TLSv1_2_server_method
QSslSocket: cannot resolve SSL_select_next_proto
QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
我做错了什么?有没有办法:

  • 按我想要的方式使用WebSocket?(即与
    QWebSocketServer
  • 在https页面上使用非安全WebSocket?仅在my Chrome扩展注入的脚本中使用

谢谢,

您在系统上安装了OpenSSL库吗?@Nejat是的,
QSslSocket::supportsSsl()
返回true。我正在使用Visual Studio 2013构建我的程序,我正在寻找链接openssl的正确方法,但我没有找到任何东西……我认为您还应该将
libeay32.dll
ssleay32.dll
\bin
文件夹复制到
QtNetwork4.dll
所在的位置。@Nejat我已经这么做了,但是没有用。我会在有更多空闲时间的时候尝试用OpenSSL构建Qt。你有什么解决方案吗?我也有同样的问题,尝试将Qt cleint连接到node Js服务器,我得到了同样的警告,即使我不想使用ssl。