3
4

2 回答 2

2

检查websocket库的路径是否正确(可以找到库)

我猜这个函数libwebsocket_create_context()改变了它的参数。看一下 libwebsockets 示例test-server.c

现在应该是这样的:

/* old Version:
context = libwebsocket_create_context(port, interface, protocols,
                                      libwebsocket_internal_extensions,
                                      cert_path, key_path, -1, -1, opts);
*/

//-- new Version:
struct lws_context_creation_info info;

memset(&info, 0, sizeof info);
info.port = port;
info.iface = interface;
info.protocols = protocols;
info.extensions = libwebsocket_get_internal_extensions();
//if (!use_ssl) {
    info.ssl_cert_filepath = NULL;
    info.ssl_private_key_filepath = NULL;
//} else {
//  info.ssl_cert_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.pem";
//  info.ssl_private_key_filepath = LOCAL_RESOURCE_PATH"/libwebsockets-test-server.key.pem";
//}
info.gid = -1;
info.uid = -1;
info.options = opts;

context = libwebsocket_create_context(&info);
//------
于 2013-03-08T21:03:03.343 回答
0

我认为最近,直到 v2.0,libwebsockets 经历了一些大的重构,例如将接口名称从 libwebsockets_... 更改为 lws_...。我需要一个 C++ 包装器,如果找不到更新的包装器,我可以自己编写。希望它更稳定,也许 v2.0 会给我们。

于 2016-05-27T19:57:46.777 回答