{"id":115043,"date":"2026-10-11T00:10:15","date_gmt":"2026-10-10T16:10:15","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/115043.html"},"modified":"2026-10-11T00:10:15","modified_gmt":"2026-10-10T16:10:15","slug":"%e5%9f%ba%e4%ba%8e-libwebsockets-%e6%9e%84%e5%bb%ba%e6%9c%80%e5%b0%8f-http-%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%9aminimal-http-server-%e7%a4%ba%e4%be%8b%e5%85%a8%e8%a7%a3%e6%9e%90%ef%bc%88ten-framework","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/115043.html","title":{"rendered":"\u57fa\u4e8e libwebsockets \u6784\u5efa\u6700\u5c0f HTTP \u670d\u52a1\u5668\uff1aminimal-http-server \u793a\u4f8b\u5168\u89e3\u6790\uff08TEN-framework \u96c6\u6210\u89c6\u89d2\uff09"},"content":{"rendered":"<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span><\/li>\n<li><span class=\"gcb-tag\">AI Agent<\/span><\/li>\n<li><span class=\"gcb-tag\">\u591a\u6a21\u6001<\/span><\/li>\n<li><span class=\"gcb-tag\">\u8bed\u97f3<\/span><\/li>\n<li><span class=\"gcb-tag\">AI \u5e94\u7528<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011ten-framework<\/h3>\n<p class=\"gcb-project-desc\"> Open-source framework for conversational voice AI agents<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/TEN-framework\/ten-framework<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<h3>\u5bfc\u8bfb<\/h3>\n<p>minimal-http-server \u662f libwebsockets&#xff08;lws&#xff09;\u5b98\u65b9\u793a\u4f8b\u96c6\u4e2d\u6700\u7b80\u7684 HTTP \u670d\u52a1\u5668\u5b9e\u73b0&#xff1a;\u4ec5\u7528\u4e00\u4e2a C \u6e90\u6587\u4ef6&#xff0c;\u5373\u53ef\u628a\u672c\u5730\u76ee\u5f55\u4ee5\u9759\u6001\u7ad9\u70b9\u5f62\u5f0f\u53d1\u5e03\u5230 http:\/\/localhost:7681&#xff0c;\u5e76\u9644\u5e26\u81ea\u5b9a\u4e49 404 \u9519\u8bef\u9875\u3001HTTP \u5b89\u5168\u54cd\u5e94\u5934\u7b49\u80fd\u529b\u3002\u672c\u6587\u4ee5\u8be5\u793a\u4f8b\u4e3a\u6838\u5fc3&#xff0c;\u5148\u5e26\u4f60\u5b8c\u6210\u6784\u5efa\u3001\u8fd0\u884c\u4e0e\u9a8c\u8bc1&#xff0c;\u518d\u9010\u5b57\u6bb5\u5256\u6790 lws_http_mount \u4e0e lws_context_creation_info \u7684\u914d\u7f6e\u542b\u4e49&#xff0c;\u6700\u540e\u7ed3\u5408 TEN-framework \u4ed3\u5e93\u4e2d\u7684\u5b9e\u9645\u96c6\u6210\u65b9\u5f0f&#xff08;BUILD.gn \u4e0e simple_http_server_cpp&#xff09;&#xff0c;\u8bf4\u660e\u5982\u4f55\u628a\u8fd9\u4e2a&#034;\u6700\u5c0f\u9aa8\u67b6&#034;\u6269\u5c55\u6210\u5d4c\u5165 TEN \u6269\u5c55\u7cfb\u7edf\u4e2d\u7684\u771f\u5b9e HTTP \u670d\u52a1\u3002\u8bfb\u5b8c\u4f60\u5c06\u638c\u63e1 lws \u9759\u6001\u6587\u4ef6\u670d\u52a1\u7684\u5b8c\u6574\u914d\u7f6e\u6a21\u578b&#xff0c;\u4ee5\u53ca\u5b83\u5728 TEN \u6846\u67b6\u4e2d\u7684\u843d\u5730\u8def\u5f84\u3002<\/p>\n<h3>\u4e00\u3001\u793a\u4f8b\u6982\u89c8&#xff1a;\u5b83\u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898<\/h3>\n<p>libwebsockets \u5b98\u65b9\u6309\u529f\u80fd\u628a HTTP \u670d\u52a1\u7aef\u793a\u4f8b\u62c6\u6210\u4e86 20 \u4f59\u4e2a\u53d8\u4f53&#xff08;\u793a\u4f8b\u603b\u89c8&#xff09;&#xff0c;\u5176\u4e2d minimal-http-server \u88ab\u5b9a\u4f4d\u4e3a&#xff1a;<\/p>\n<p>Serves a directory over http\/1, custom 404 handler<\/p>\n<p>\u4e5f\u5c31\u662f\u8bf4&#xff0c;\u5b83\u662f\u6574\u4e2a HTTP \u793a\u4f8b\u5bb6\u65cf\u7684\u6700\u5c0f\u516c\u5171\u57fa\u5ea7&#xff1a;http\/1 \u76ee\u5f55\u9759\u6001\u670d\u52a1 &#043; \u81ea\u5b9a\u4e49 404 \u5904\u7406\u5668\u3002\u5176\u4ed6\u793a\u4f8b&#xff08;TLS\u3001Basic Auth\u3001CGI\u3001Server Side Events\u3001\u591a vhost\u3001SMP \u591a\u7ebf\u7a0b\u7b49&#xff09;\u90fd\u4ece\u8fd9\u4e00\u57fa\u7ebf\u5411\u5916\u6269\u5c55\u3002<\/p>\n<p>\u793a\u4f8b\u5b8c\u6574\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b&#xff08;\u6e90\u7801\u76ee\u5f55&#xff09;&#xff1a;<\/p>\n<p>minimal-http-server\/<br \/>\n\u251c\u2500\u2500 CMakeLists.txt        # \u6784\u5efa\u811a\u672c<br \/>\n\u251c\u2500\u2500 minimal-http-server.c # \u552f\u4e00\u4e00\u4e2a C \u6e90\u6587\u4ef6<br \/>\n\u251c\u2500\u2500 README.md             # \u5b98\u65b9\u4f7f\u7528\u8bf4\u660e<br \/>\n\u2514\u2500\u2500 mount-origin\/         # \u9759\u6001\u7ad9\u70b9\u6839\u76ee\u5f55&#xff08;\u9ed8\u8ba4\u6302\u8f7d\u6765\u6e90&#xff09;<br \/>\n    \u251c\u2500\u2500 404.html<br \/>\n    \u251c\u2500\u2500 favicon.ico<br \/>\n    \u251c\u2500\u2500 index.html<br \/>\n    \u251c\u2500\u2500 libwebsockets.org-logo.svg<br \/>\n    \u2514\u2500\u2500 strict-csp.svg<\/p>\n<p>\u6574\u4e2a\u670d\u52a1\u7aef\u903b\u8f91\u538b\u7f29\u5728 minimal-http-server.c \u4e00\u4e2a\u6587\u4ef6\u91cc&#xff0c;\u6838\u5fc3\u53ea\u6709\u4e09\u6b65&#xff1a;\u5b9a\u4e49\u6302\u8f7d&#xff08;mount&#xff09;\u2192 \u521b\u5efa\u4e0a\u4e0b\u6587&#xff08;context&#xff09;\u2192 \u8fdb\u5165\u670d\u52a1\u5faa\u73af&#xff08;service loop&#xff09;\u3002\u4e0b\u9762\u6309\u5b98\u65b9 README \u7684\u6d41\u7a0b\u9010\u6b65\u64cd\u4f5c\u3002<\/p>\n<h3>\u4e8c\u3001\u6784\u5efa&#xff1a;\u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6<\/h3>\n<p>\u5b98\u65b9 README \u7ed9\u51fa\u7684\u6784\u5efa\u547d\u4ee4\u975e\u5e38\u7b80\u6d01&#xff1a;<\/p>\n<p>cmake . &amp;&amp; make<\/p>\n<p>\u8fd9\u6761\u547d\u4ee4\u6210\u7acb\u7684\u524d\u63d0\u4e0e\u7ec6\u8282&#xff0c;\u85cf\u5728 CMakeLists.txt \u4e2d&#xff1a;<\/p>\n<p>project(lws-minimal-http-server C)<br \/>\ncmake_minimum_required(VERSION 2.8.12)<br \/>\nfind_package(libwebsockets CONFIG REQUIRED)<\/p>\n<ul>\n<li>find_package(libwebsockets CONFIG REQUIRED)&#xff1a;\u8981\u6c42\u7cfb\u7edf\u4e2d\u5df2\u901a\u8fc7 cmake &#8211;install \u5b89\u88c5 libwebsockets \u7684 CMake \u914d\u7f6e\u6587\u4ef6&#xff0c;\u5373\u5148\u8981\u6709\u4e00\u4efd\u53ef\u7528\u7684 lws \u5f00\u53d1\u73af\u5883&#xff1b;<\/li>\n<li>include(LwsCheckRequirements) \u540e\u901a\u8fc7 require_lws_config(LWS_ROLE_H1 1 requirements) \u4e0e require_lws_config(LWS_WITH_SERVER 1 requirements) \u68c0\u67e5\u5f53\u524d lws \u6784\u5efa\u662f\u5426\u542f\u7528\u4e86 HTTP\/1 \u89d2\u8272\u548c\u670d\u52a1\u7aef\u80fd\u529b\u2014\u2014\u8fd9\u4e24\u9879\u6b63\u662f\u8fd0\u884c\u672c\u4f8b\u7684\u6700\u4f4e\u7f16\u8bd1\u671f\u8981\u6c42&#xff1b;<\/li>\n<li>\u94fe\u63a5\u9636\u6bb5\u4f18\u5148\u4f7f\u7528\u5171\u4eab\u5e93 websockets_shared&#xff0c;\u5426\u5219\u56de\u9000\u5230\u9759\u6001\u5e93 websockets&#xff0c;\u5e76\u81ea\u52a8\u5e26\u5165 lws \u7684\u4f9d\u8d56\u5e93&#xff08;LIBWEBSOCKETS_DEP_LIBS&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u6784\u5efa\u6210\u529f\u540e&#xff0c;\u5de5\u4f5c\u76ee\u5f55\u4e0b\u4f1a\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6 lws-minimal-http-server\u3002<\/p>\n<p>\u63d0\u793a&#xff1a;\u5728\u672c\u4ed3\u5e93\u4e2d&#xff0c;TEN-framework \u901a\u8fc7 BUILD.gn \u7684 cmake_project(&#034;websockets&#034;) \u4ee5 GN \u6784\u5efa\u7cfb\u7edf\u96c6\u6210 libwebsockets&#xff0c;\u540c\u6837\u5f3a\u5236\u542f\u7528\u4e86 LWS_ROLE_H1&#061;ON \u4e0e LWS_WITH_SERVER&#061;ON&#xff08;\u5e76\u989d\u5916\u5f00\u542f LWS_WITH_NETWORK\u3001LWS_WITH_SSL\u3001LWS_WITH_MBEDTLS&#xff09;\u3002\u8fd9\u610f\u5473\u7740\u5728 TEN \u7684\u5b8c\u6574\u6784\u5efa\u6d41\u7a0b\u91cc&#xff0c;\u4e0a\u9762\u8fd9\u4e24\u4e2a\u7f16\u8bd1\u671f\u6761\u4ef6\u5929\u7136\u6ee1\u8db3\u3002<\/p>\n<h3>\u4e09\u3001\u8fd0\u884c\u4e0e\u9a8c\u8bc1<\/h3>\n<p>\u5b98\u65b9 README \u7ed9\u51fa\u7684\u8fd0\u884c\u65b9\u5f0f\u4e3a&#xff1a;<\/p>\n<p>.\/lws-minimal-http-server<\/p>\n<p>\u6b63\u5e38\u542f\u52a8\u65f6\u63a7\u5236\u53f0\u8f93\u51fa\u7c7b\u4f3c&#xff1a;<\/p>\n<p>[2018\/03\/04 09:30:02:7986] USER: LWS minimal http server | visit http:\/\/localhost:7681<br \/>\n[2018\/03\/04 09:30:02:7986] NOTICE: Creating Vhost &#039;default&#039; port 7681, 1 protocols, IPv6 on<\/p>\n<p>\u968f\u540e\u5728\u6d4f\u89c8\u5668\u8bbf\u95ee http:\/\/localhost:7681&#xff0c;\u5373\u53ef\u770b\u5230 mount-origin\/index.html \u6e32\u67d3\u51fa\u7684\u9875\u9762\u3002\u8be5\u9875\u9762\u672c\u8eab\u8fd8\u5185\u7f6e\u4e86\u4e00\u4e2a\u53ef\u9a8c\u8bc1 404 \u673a\u5236\u7684\u5165\u53e3&#xff1a;\u70b9\u51fb\u5176\u4e2d\u7684 notextant.html \u94fe\u63a5\u8bbf\u95ee\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u9875\u9762&#xff0c;\u670d\u52a1\u7aef\u4f1a\u8fd4\u56de\u81ea\u5b9a\u4e49\u7684 404.html&#xff08;&#034;404 \/ Sorry, that file doesn&#039;t exist.&#034;&#xff09;&#xff0c;\u800c\u4e0d\u662f\u6d4f\u89c8\u5668\u9ed8\u8ba4\u9519\u8bef\u9875\u3002<\/p>\n<p>\u65e5\u5fd7\u4e2d\u503c\u5f97\u6ce8\u610f\u7684\u4e24\u6761\u4fe1\u606f&#xff1a;<\/p>\n<ul>\n<li>visit http:\/\/localhost:7681&#xff1a;\u7531\u6e90\u7801\u4e2d\u7684 lwsl_user(&#034;LWS minimal http server | visit http:\/\/localhost:7681\\\\n&#034;) \u6253\u5370&#xff0c;\u5176\u4e2d lwsl_user \u5bf9\u5e94 LLL_USER \u65e5\u5fd7\u7ea7\u522b&#xff1b;<\/li>\n<li>Creating Vhost &#039;default&#039; port 7681, 1 protocols, IPv6 on&#xff1a;\u8bf4\u660e lws \u81ea\u52a8\u521b\u5efa\u4e86\u540d\u4e3a default \u7684 vhost&#xff0c;\u7ed1\u5b9a 7681 \u7aef\u53e3&#xff0c;\u9ed8\u8ba4\u540c\u65f6\u76d1\u542c IPv4\/IPv6\u3002<\/li>\n<\/ul>\n<h3>\u56db\u3001\u6838\u5fc3\u6e90\u7801\u5256\u6790&#xff1a;\u4e00\u4e2a\u6700\u5c0f HTTP \u670d\u52a1\u5668\u7684\u5168\u90e8\u914d\u7f6e<\/h3>\n<h4>4.1 \u9759\u6001\u76ee\u5f55\u6302\u8f7d&#xff1a;lws_http_mount \u7ed3\u6784\u4f53<\/h4>\n<p>\u670d\u52a1&#034;\u54ea\u4e2a URL \u6620\u5c04\u5230\u54ea\u4e2a\u672c\u5730\u76ee\u5f55&#034;\u7531 minimal-http-server.c \u4e2d\u7684 lws_http_mount \u9759\u6001\u5b9e\u4f8b\u63cf\u8ff0&#xff1a;<\/p>\n<p>static const struct lws_http_mount mount &#061; {<br \/>\n\/* .mount_next *\/NULL,\/* linked-list &#034;next&#034; *\/<br \/>\n\/* .mountpoint *\/&#034;\/&#034;,\/* mountpoint URL *\/<br \/>\n\/* .origin *\/&#034;.\/mount-origin&#034;, \/* serve from dir *\/<br \/>\n\/* .def *\/&#034;index.html&#034;,\/* default filename *\/<br \/>\n\/* .protocol *\/NULL,<br \/>\n\/* .cgienv *\/NULL,<br \/>\n\/* .extra_mimetypes *\/NULL,<br \/>\n\/* .interpret *\/NULL,<br \/>\n\/* .cgi_timeout *\/0,<br \/>\n\/* .cache_max_age *\/0,<br \/>\n\/* .auth_mask *\/0,<br \/>\n\/* .cache_reusable *\/0,<br \/>\n\/* .cache_revalidate *\/0,<br \/>\n\/* .cache_intermediaries *\/0,<br \/>\n\/* .origin_protocol *\/LWSMPRO_FILE,\/* files in a dir *\/<br \/>\n\/* .mountpoint_len *\/1,\/* char count *\/<br \/>\n\/* .basic_auth_login_file *\/NULL,<br \/>\n};<\/p>\n<p>\u5404\u5b57\u6bb5\u7684\u5b9e\u8df5\u542b\u4e49&#xff1a;<\/p>\n<table>\n<tr>\u5b57\u6bb5\u503c\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>mount_next<\/td>\n<td>NULL<\/td>\n<td>\u6302\u8f7d\u70b9\u94fe\u8868\u6307\u9488&#xff0c;\u672c\u4f8b\u53ea\u6709\u4e00\u4e2a\u6302\u8f7d&#xff1b;\u591a\u76ee\u5f55\u670d\u52a1\u65f6\u53ef\u5728\u6b64\u4e32\u8054<\/td>\n<\/tr>\n<tr>\n<td>mountpoint<\/td>\n<td>&#034;\/&#034;<\/td>\n<td>URL \u6302\u8f7d\u70b9&#xff0c;\u6839\u8def\u5f84 \/ \u6620\u5c04\u5230\u672c\u5730\u76ee\u5f55<\/td>\n<\/tr>\n<tr>\n<td>mountpoint_len<\/td>\n<td>1<\/td>\n<td>mountpoint \u7684\u5b57\u7b26\u957f\u5ea6&#xff0c;\u5fc5\u987b\u4e0e\u5b57\u7b26\u4e32\u4e00\u81f4&#xff08;&#034;\/&#034; \u4e3a 1 \u4e2a\u5b57\u7b26&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>origin<\/td>\n<td>&#034;.\/mount-origin&#034;<\/td>\n<td>\u9759\u6001\u8d44\u6e90\u6765\u6e90\u76ee\u5f55&#xff0c;\u76f8\u5bf9\u4e8e\u8fdb\u7a0b\u542f\u52a8\u65f6\u7684\u5de5\u4f5c\u76ee\u5f55&#xff0c;\u8fd9\u662f\u6700\u5bb9\u6613\u8e29\u7684\u5751<\/td>\n<\/tr>\n<tr>\n<td>def<\/td>\n<td>&#034;index.html&#034;<\/td>\n<td>\u8bf7\u6c42\u76ee\u5f55\u65f6\u9ed8\u8ba4\u8fd4\u56de\u7684\u6587\u4ef6\u540d<\/td>\n<\/tr>\n<tr>\n<td>origin_protocol<\/td>\n<td>LWSMPRO_FILE<\/td>\n<td>\u6765\u6e90\u7c7b\u578b\u4e3a&#034;\u6587\u4ef6\u7cfb\u7edf\u76ee\u5f55&#034;&#xff0c;\u5373\u7eaf\u9759\u6001\u6587\u4ef6\u670d\u52a1&#xff08;\u4e0d\u6d89\u53ca CGI&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>basic_auth_login_file<\/td>\n<td>NULL<\/td>\n<td>\u672a\u542f\u7528 Basic Auth&#xff08;\u5bf9\u5e94\u793a\u4f8b\u89c1 minimal-http-server-basicauth&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5176\u4f59\u4e3a 0\/NULL \u7684\u5b57\u6bb5&#xff08;cache_max_age\u3001cache_reusable\u3001cache_revalidate\u3001cache_intermediaries&#xff09;\u8868\u793a\u4e0d\u505a HTTP \u7f13\u5b58\u63a7\u5236&#xff0c;\u53ef\u4fdd\u6301\u9ed8\u8ba4\u5173\u95ed\u3002<\/p>\n<h4>4.2 \u4e0a\u4e0b\u6587\u521b\u5efa&#xff1a;lws_context_creation_info<\/h4>\n<p>\u670d\u52a1\u5b9e\u4f8b\u672c\u8eab\u7531 main \u51fd\u6570 \u7ec4\u88c5&#xff1a;<\/p>\n<p>memset(&amp;info, 0, sizeof info); \/* otherwise uninitialized garbage *\/<br \/>\ninfo.port &#061; 7681;<br \/>\ninfo.mounts &#061; &amp;mount;<br \/>\ninfo.error_document_404 &#061; &#034;\/404.html&#034;;<br \/>\ninfo.options &#061;<br \/>\nLWS_SERVER_OPTION_HTTP_HEADERS_SECURITY_BEST_PRACTICES_ENFORCE;<\/p>\n<p>if (lws_cmdline_option(argc, argv, &#034;&#8211;h2-prior-knowledge&#034;))<br \/>\ninfo.options |&#061; LWS_SERVER_OPTION_H2_PRIOR_KNOWLEDGE;<\/p>\n<p>context &#061; lws_create_context(&amp;info);<\/p>\n<ul>\n<li>info.port &#061; 7681&#xff1a;\u76d1\u542c\u7aef\u53e3\u3002\u6ce8\u610f\u6e90\u7801\u6ce8\u91ca\u4e0e\u5b98\u65b9\u65e5\u5fd7\u4e00\u81f4\u2014\u2014\u4fee\u6539\u76d1\u542c\u7aef\u53e3\u53ea\u9700\u6539\u8fd9\u4e00\u4e2a\u5b57\u6bb5&#xff1b;<\/li>\n<li>info.mounts &#061; &amp;mount&#xff1a;\u628a\u4e0a\u4e00\u8282\u7684\u6302\u8f7d\u8868\u6302\u5230\u4e0a\u4e0b\u6587\u4e0a&#xff1b;<\/li>\n<li>info.error_document_404 &#061; &#034;\/404.html&#034;&#xff1a;\u81ea\u5b9a\u4e49 404 \u5904\u7406\u5668&#xff0c;\u8fd9\u6b63\u662f\u793a\u4f8b\u5b9a\u4f4d\u4e2d&#034;custom 404 handler&#034;\u7684\u5b9e\u73b0\u70b9\u3002\u8bf7\u6c42\u4e0d\u5b58\u5728\u7684\u8def\u5f84\u65f6&#xff0c;lws \u76f4\u63a5\u8fd4\u56de\u6302\u8f7d\u76ee\u5f55\u4e0b\u7684 404.html&#xff08;\u89c1 mount-origin\/404.html&#xff09;&#xff1b;<\/li>\n<li>info.options &#061; LWS_SERVER_OPTION_HTTP_HEADERS_SECURITY_BEST_PRACTICES_ENFORCE&#xff1a;\u542f\u7528 lws \u5185\u7f6e\u7684 HTTP \u5b89\u5168\u54cd\u5e94\u5934\u6700\u4f73\u5b9e\u8df5&#xff08;\u5982 CSP \u76f8\u5173\u5934&#xff09;&#xff0c;\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u9996\u9875\u4f1a\u5c55\u793a strict-csp.svg \u56fe\u6807&#xff1b;<\/li>\n<li>\u82e5\u547d\u4ee4\u884c\u5e26 &#8211;h2-prior-knowledge&#xff0c;\u518d\u53e0\u52a0 LWS_SERVER_OPTION_H2_PRIOR_KNOWLEDGE&#xff0c;\u670d\u52a1\u5c06\u4ee5 HTTP\/2 \u76f4\u8fde\u65b9\u5f0f&#xff08;h2 prior knowledge&#xff0c;\u4e0d\u7ecf Upgrade \u534f\u5546&#xff09;\u5de5\u4f5c\u3002<\/li>\n<\/ul>\n<h4>4.3 \u670d\u52a1\u751f\u547d\u5468\u671f&#xff1a;create \u2192 service \u2192 destroy<\/h4>\n<p>context &#061; lws_create_context(&amp;info);<br \/>\n&#8230;<br \/>\nwhile (n &gt;&#061; 0 &amp;&amp; !interrupted)<br \/>\nn &#061; lws_service(context, 0);<\/p>\n<p>lws_context_destroy(context);<\/p>\n<p>\u8fd9\u662f lws \u670d\u52a1\u7aef\u7684\u6807\u51c6\u4e09\u9636\u6bb5\u6a21\u578b&#xff1a;<\/p>\n<li>lws_create_context(&amp;info)&#xff1a;\u4f9d\u636e info \u4e00\u6b21\u6027\u521b\u5efa\u4e0a\u4e0b\u6587\u4e0e\u9ed8\u8ba4 vhost&#xff0c;\u5931\u8d25\u65f6\u8fd4\u56de NULL&#xff0c;\u793a\u4f8b\u968f\u5373\u4ee5\u9000\u51fa\u7801 1 \u7ec8\u6b62&#xff1b;<\/li>\n<li>lws_service(context, 0)&#xff1a;\u4e8b\u4ef6\u5faa\u73af\u6838\u5fc3\u3002\u7b2c\u4e8c\u4e2a\u53c2\u6570 0 \u8868\u793a\u6700\u591a\u7b49\u5f85 0 \u79d2&#xff0c;\u5373\u975e\u963b\u585e\u8f6e\u8be2&#xff1b;\u8fd4\u56de\u503c n &lt; 0 \u8868\u793a\u51fa\u73b0\u81f4\u547d\u9519\u8bef\u9700\u9000\u51fa&#xff1b;<\/li>\n<li>lws_context_destroy(context)&#xff1a;\u9000\u51fa\u5faa\u73af\u540e\u7edf\u4e00\u9500\u6bc1\u4e0a\u4e0b\u6587&#xff0c;\u91ca\u653e\u6240\u6709\u6302\u8f7d\u3001vhost \u4e0e\u8fde\u63a5\u8d44\u6e90\u3002<\/li>\n<p>\u4f18\u96c5\u9000\u51fa\u7531 signal(SIGINT, sigint_handler) \u914d\u5408\u9759\u6001\u6807\u5fd7 interrupted \u5b9e\u73b0&#xff1a;\u6536\u5230 Ctrl&#043;C \u65f6\u7f6e\u4f4d\u6807\u5fd7&#xff0c;\u4e3b\u5faa\u73af\u81ea\u7136\u7ed3\u675f&#xff0c;\u4ece\u800c\u4fdd\u8bc1\u8d70\u5b8c\u6574\u7684\u9500\u6bc1\u8def\u5f84\u800c\u4e0d\u662f\u88ab\u4fe1\u53f7\u7c97\u66b4\u6253\u65ad\u3002<\/p>\n<h4>4.4 \u547d\u4ee4\u884c\u53c2\u6570\u4e0e\u65e5\u5fd7\u7ea7\u522b<\/h4>\n<p>\u793a\u4f8b\u5185\u7f6e\u4e86\u4e00\u4e2a -d \u53c2\u6570\u7528\u4e8e\u63a7\u5236\u65e5\u5fd7\u7ea7\u522b&#xff1a;<\/p>\n<p>if ((p &#061; lws_cmdline_option(argc, argv, &#034;-d&#034;)))<br \/>\nlogs &#061; atoi(p);<br \/>\nlws_set_log_level(logs, NULL);<\/p>\n<p>\u9ed8\u8ba4\u7ea7\u522b\u4e3a LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE\u3002\u6e90\u7801\u6ce8\u91ca\u7279\u522b\u8bf4\u660e&#xff1a;\u82e5\u8981\u770b\u5230 LLL_INFO \u53ca\u4ee5\u4e0a\u66f4\u8be6\u7ec6\u7684\u65e5\u5fd7&#xff0c;lws \u5fc5\u987b\u4ee5 -DCMAKE_BUILD_TYPE&#061;DEBUG \u6784\u5efa&#xff0c;RELEASE \u6784\u5efa\u4f1a\u88c1\u526a\u6389\u8fd9\u4e9b\u7ea7\u522b\u7684\u65e5\u5fd7\u8f93\u51fa\u3002<\/p>\n<h3>\u4e94\u3001\u4ece\u6700\u5c0f\u9aa8\u67b6\u5230 TEN \u6846\u67b6&#xff1a;\u4ed3\u5e93\u5185\u7684\u771f\u5b9e\u96c6\u6210\u8def\u5f84<\/h3>\n<p>minimal-http-server \u4e0d\u6b62\u662f\u72ec\u7acb\u793a\u4f8b\u2014\u2014\u5b83\u5728\u5f53\u524d\u4ed3\u5e93\u4e2d\u6709\u4e24\u6761\u53ef\u9a8c\u8bc1\u7684\u843d\u5730\u7ebf\u7d22&#xff0c;\u80fd\u5e2e\u52a9\u4f60\u7406\u89e3&#034;\u6700\u5c0f\u9759\u6001\u670d\u52a1&#034;\u5982\u4f55\u5728\u771f\u5b9e\u5de5\u7a0b\u4e2d\u5347\u7ea7\u4e3a&#034;\u53ef\u7f16\u7a0b HTTP \u670d\u52a1&#034;\u3002<\/p>\n<h4>5.1 \u6784\u5efa\u5c42\u9762&#xff1a;GN \u5de5\u7a0b\u4e2d\u7684 lws \u96c6\u6210<\/h4>\n<p>TEN-framework \u5e76\u672a\u76f4\u63a5\u7f16\u8bd1\u8fd9\u4e2a\u793a\u4f8b&#xff0c;\u800c\u662f\u4ee5 GN \u7684 cmake_project(&#034;websockets&#034;) \u628a\u6574\u4e2a libwebsockets \u4f5c\u4e3a\u4e09\u65b9\u4f9d\u8d56\u5f15\u5165&#xff08;third_party\/libwebsockets\/BUILD.gn&#xff09;\u3002\u5176\u4e2d\u4e0e\u672c\u793a\u4f8b\u76f4\u63a5\u76f8\u5173\u7684\u914d\u7f6e\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>LWS_ROLE_H1&#061;ON\u3001LWS_WITH_SERVER&#061;ON&#xff1a;\u4e0e\u672c\u4f8b CMakeLists.txt \u4e2d\u7684 require_lws_config \u68c0\u67e5\u9879\u5b8c\u5168\u5bf9\u5e94&#xff1b;<\/li>\n<li>LWS_WITH_HTTP2&#061;OFF&#xff1a;\u5f53\u524d TEN \u7684 lws \u534f\u8bae\u5b9e\u73b0\u5c1a\u672a\u9002\u914d HTTP\/2 \u5206\u5e27&#xff0c;\u6545\u663e\u5f0f\u5173\u95ed&#xff08;\u6e90\u7801\u6ce8\u91ca\u6307\u51fa HTTP\/2 \u8981\u6c42\u8bf7\u6c42\u5934\u4e0e\u8bf7\u6c42\u4f53\u5206\u5e27\u53d1\u9001&#xff0c;\u4e0e\u73b0\u6709 http\/1.1 \u540c\u5e27\u53d1\u9001\u4e0d\u517c\u5bb9&#xff09;\u2014\u2014\u56e0\u6b64\u793a\u4f8b\u4e2d\u7684 &#8211;h2-prior-knowledge \u9009\u9879\u5728 TEN \u7684\u6784\u5efa\u914d\u7f6e\u4e0b\u4e0d\u53ef\u7528&#xff0c;\u8fd9\u5c5e\u4e8e\u96c6\u6210\u5c42\u9762\u7684\u524d\u7f6e\u9650\u5236&#xff1b;<\/li>\n<li>LWS_WITH_MBEDTLS&#061;ON\u3001LWS_WITH_SSL&#061;ON&#xff1a;TLS \u540e\u7aef\u9009\u7528 mbedTLS&#xff0c;\u8fd9\u4e5f\u662f\u6784\u5efa\u65f6\u540c\u6b65\u7f16\u8bd1 third_party\/mbedtls \u7684\u539f\u56e0\u3002<\/li>\n<\/ul>\n<h4>5.2 \u8fd0\u884c\u65f6\u5c42\u9762&#xff1a;simple_http_server_cpp \u6269\u5c55<\/h4>\n<p>\u4ed3\u5e93\u7684\u793a\u4f8b\u6269\u5c55 simple_http_server_cpp \u5728 TEN \u6846\u67b6\u5185\u7528\u540c\u6837\u7684 lws API \u5b9e\u73b0\u4e86\u5b8c\u6574 HTTP \u670d\u52a1&#xff0c;\u4e0e minimal-http-server \u5f62\u6210\u9c9c\u660e\u7684&#034;\u9759\u6001 vs \u52a8\u6001&#034;\u5bf9\u7167&#xff1a;<\/p>\n<ul>\n<li>\u76f8\u540c\u7684\u9aa8\u67b6&#xff1a;lws_create_context(&amp;info) \u2192 while (n &gt;&#061; 0) n &#061; lws_service(ctx, 0) \u2192 lws_context_destroy&#xff0c;\u5e76\u4e14\u628a\u670d\u52a1\u5faa\u73af\u642c\u8fdb\u4e86\u72ec\u7acb\u7ebf\u7a0b&#xff08;create_http_server_thread&#xff09;&#xff1b;<\/li>\n<li>\u4ece\u9759\u6001\u6302\u8f7d\u5347\u7ea7\u4e3a\u534f\u8bae\u56de\u8c03&#xff1a;\u4e0d\u518d\u4f9d\u8d56 lws_http_mount \u7684\u6587\u4ef6\u670d\u52a1&#xff0c;\u800c\u662f\u6ce8\u518c lws_protocols \u56de\u8c03&#xff0c;\u5728 LWS_CALLBACK_HTTP\u3001LWS_CALLBACK_HTTP_BODY\u3001LWS_CALLBACK_HTTP_BODY_COMPLETION\u3001LWS_CALLBACK_HTTP_WRITEABLE \u7b49\u4e8b\u4ef6\u4e2d\u81ea\u884c\u89e3\u6790 GET\/POST\/PUT\/DELETE \u7b49\u8bf7\u6c42&#xff08;parse_http_method&#xff09;&#xff0c;\u628a HTTP \u8bf7\u6c42\u8f6c\u6362\u4e3a TEN \u547d\u4ee4&#xff08;ten_env.send_cmd&#xff09;\u4e0b\u53d1\u5230 TEN graph&#xff1b;<\/li>\n<li>\u5173\u952e\u7684 API \u8865\u5145&#xff1a;lws_add_http_common_headers &#043; lws_finalize_http_header &#043; lws_write \u624b\u52a8\u62fc\u88c5\u54cd\u5e94\u5934\u4e0e\u54cd\u5e94\u4f53&#xff08;\u5bf9\u5e94 main.cc&#xff09;&#xff0c;lws_cancel_service \u7528\u4e8e\u8de8\u7ebf\u7a0b\u5524\u9192\u4e8b\u4ef6\u5faa\u73af&#xff0c;lws_callback_on_writable \u7528\u4e8e\u6309\u9700\u89e6\u53d1\u5199\u4e8b\u4ef6\u3002<\/li>\n<\/ul>\n<p>\u5bf9\u6bd4\u53ef\u89c1&#xff1a;minimal-http-server \u5c55\u793a\u7684\u662f lws &#034;\u96f6\u56de\u8c03\u3001\u7eaf\u914d\u7f6e&#034; \u7684\u9759\u6001\u670d\u52a1\u8def\u5f84&#xff1b;\u800c TEN \u7684 simple_http_server_cpp \u5c55\u793a\u7684\u662f\u540c\u4e00\u5e95\u5c42 API \u9762\u5411\u4e1a\u52a1\u5b9a\u5236\u7684\u5b8c\u6574\u5f62\u6001\u3002\u4e8c\u8005\u5171\u7528\u540c\u4e00\u5957 context\/service\/destroy \u751f\u547d\u5468\u671f\u6a21\u578b&#xff0c;\u8bfb\u61c2\u524d\u8005\u662f\u5feb\u901f\u8fdb\u5165\u540e\u8005\u7684\u6700\u77ed\u8def\u5f84\u3002<\/p>\n<h3>\u516d\u3001\u52a8\u624b\u5b9a\u5236&#xff1a;\u4e09\u4e2a\u9ad8\u9891\u6539\u52a8\u70b9<\/h3>\n<p>\u57fa\u4e8e\u4e0a\u6587\u6e90\u7801&#xff0c;\u4ee5\u4e0b\u6539\u52a8\u90fd\u662f&#034;\u6539\u4e00\u884c\u5373\u53ef\u751f\u6548&#034;\u7684\u5b9e\u64cd\u7ea7\u5b9a\u5236&#xff1a;<\/p>\n<li>\u6362\u7aef\u53e3&#xff1a;\u4fee\u6539 info.port &#061; 7681; \u4e3a\u5176\u4ed6\u503c&#xff08;\u5982 8000&#xff09;&#xff0c;\u8bbf\u95ee\u5730\u5740\u968f\u4e4b\u53d8\u5316&#xff1b;<\/li>\n<li>\u6362\u7ad9\u70b9\u76ee\u5f55&#xff1a;\u628a mount.origin \u4ece &#034;.\/mount-origin&#034; \u6539\u4e3a\u81ea\u5df1\u7684\u76ee\u5f55&#xff08;\u5982 &#034;.\/www&#034;&#xff09;&#xff0c;\u5e76\u4fdd\u8bc1 mountpoint_len\u3001mountpoint \u4e0e def \u4fdd\u6301\u4e00\u81f4&#xff1b;\u6ce8\u610f origin \u662f\u76f8\u5bf9\u542f\u52a8\u76ee\u5f55\u89e3\u6790\u7684&#xff0c;\u5efa\u8bae\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\u907f\u514d\u6b67\u4e49&#xff1b;<\/li>\n<li>\u6362 404 \u9875\u9762&#xff1a;\u4fee\u6539 info.error_document_404 \u6307\u5411\u7684\u8def\u5f84&#xff0c;\u4f8b\u5982 &#034;\/404.html&#034; \u6539\u4e3a\u81ea\u5b9a\u4e49\u7684 &#034;\/not-found.html&#034;&#xff0c;\u5e76\u5728 mount-origin \u4e0b\u653e\u7f6e\u5bf9\u5e94\u6587\u4ef6\u3002<\/li>\n<p>\u82e5\u8981\u9a8c\u8bc1\u6539\u52a8&#xff0c;\u91cd\u65b0\u6267\u884c cmake . &amp;&amp; make \u540e\u518d\u6b21\u8fd0\u884c\u5373\u53ef&#xff0c;\u65e5\u5fd7\u4e2d port 7681 \u4e00\u884c\u4f1a\u540c\u6b65\u53cd\u6620\u65b0\u7aef\u53e3\u3002<\/p>\n<h3>\u7ed3\u8bed<\/h3>\n<p>minimal-http-server \u7528\u4e0d\u8db3\u767e\u884c C \u4ee3\u7801&#xff0c;\u628a libwebsockets \u670d\u52a1\u7aef\u7684\u4e09\u5927\u6838\u5fc3\u6982\u5ff5\u2014\u2014\u6302\u8f7d\u8868&#xff08;lws_http_mount&#xff09;\u3001\u4e0a\u4e0b\u6587\u4fe1\u606f&#xff08;lws_context_creation_info&#xff09;\u4e0e\u751f\u547d\u5468\u671f\u5faa\u73af&#xff08;create\/service\/destroy&#xff09;\u2014\u2014\u5b8c\u6574\u5448\u73b0\u51fa\u6765&#xff0c;\u5e76\u987a\u5e26\u6f14\u793a\u4e86\u81ea\u5b9a\u4e49 404\u3001\u5b89\u5168\u54cd\u5e94\u5934\u4e0e\u53ef\u9009 HTTP\/2 \u76f4\u8fde\u3002\u5728\u5f53\u524d\u4ed3\u5e93\u4e2d&#xff0c;\u5b83\u65e2\u662f libwebsockets \u793a\u4f8b\u5bb6\u65cf\u7684\u6700\u5c0f\u57fa\u7ebf&#xff0c;\u4e5f\u662f\u7406\u89e3 TEN-framework \u5982\u4f55\u628a\u8be5\u5e93\u7f16\u8bd1\u8fdb\u5de5\u7a0b&#xff08;BUILD.gn&#xff09;\u5e76\u5728\u6269\u5c55\u5185\u4e8c\u6b21\u5f00\u53d1&#xff08;simple_http_server_cpp&#xff09;\u7684\u5165\u53e3\u3002\u5efa\u8bae\u6309\u672c\u6587\u7b2c\u4e8c\u8282\u5b8c\u6210\u4e00\u6b21\u6784\u5efa\u8fd0\u884c&#xff0c;\u518d\u5bf9\u7167\u7b2c\u56db\u8282\u6e90\u7801\u9010\u5b57\u6bb5\u63a8\u6572&#xff0c;\u5373\u53ef\u7262\u56fa\u638c\u63e1 lws \u9759\u6001 HTTP \u670d\u52a1\u7684\u5b8c\u6574\u914d\u7f6e\u6a21\u578b\u3002<\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" class=\"gcb-icon-like\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010161014-6aca6366e5b21.svg\" alt=\"\" width=\"16\" height=\"16\" \/> <span class=\"gcb-like-text\">\u8d5e<\/span>  <\/p>\n<p>   <span class=\"gcb-share-text\">\u5206\u4eab<\/span>  <\/p>\n<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span><\/li>\n<li><span class=\"gcb-tag\">AI Agent<\/span><\/li>\n<li><span class=\"gcb-tag\">\u591a\u6a21\u6001<\/span><\/li>\n<li><span class=\"gcb-tag\">\u8bed\u97f3<\/span><\/li>\n<li><span class=\"gcb-tag\">AI \u5e94\u7528<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011ten-framework<\/h3>\n<p class=\"gcb-project-desc\"> Open-source framework for conversational voice AI agents<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/TEN-framework\/ten-framework<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<h4 class=\"gcb-related-title\">\u76f8\u5173\u63a8\u8350<\/h4>\n<ul class=\"gcb-related-list\">\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">\u57fa\u4e8e libwebsockets \u7684\u6700\u5c0f\u5316 HTTPS \u670d\u52a1\u5668&#xff1a;minimal-http-server-tls \u5b9e\u6218\u4e0e\u6e90\u7801\u89e3\u6790<\/h5>\n<p class=\"gcb-related-item-desc\">\u57fa\u4e8e libwebsockets \u7684\u6700\u5c0f\u5316 HTTPS \u670d\u52a1\u5668&#xff1a;minimal http server tls \u5b9e\u6218\u4e0e\u6e90\u7801\u89e3\u6790 \u672c\u6307\u5357\u4ee5 TEN framewo<\/p>\n<p>     <span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span><br \/>\n     <span class=\"gcb-tag\">AI Agent<\/span><br \/>\n     <span class=\"gcb-tag\">\u591a\u6a21\u6001<\/span><br \/>\n     <span class=\"gcb-tag\">\u8bed\u97f3<\/span><br \/>\n     <span class=\"gcb-tag\">AI \u5e94\u7528<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">Karpenter EC2NodeClass \u5b8c\u5168\u6307\u5357&#xff1a;\u5728 AWS \u4e0a\u914d\u7f6e\u8282\u70b9\u7c7b&#xff08;NodeClass&#xff09;\u7684\u6bcf\u4e00\u5904\u7ec6\u8282<\/h5>\n<p class=\"gcb-related-item-desc\">Karpenter EC2NodeClass \u5b8c\u5168\u6307\u5357&#xff1a;\u5728 AWS \u4e0a\u914d\u7f6e\u8282\u70b9\u7c7b&#xff08;NodeClass&#xff09;\u7684\u6bcf\u4e00\u5904\u7ec6\u8282 \u5bfc\u8bfb \u672c\u6587\u57fa\u4e8e karpenter prov<\/p>\n<p>     <span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span><br \/>\n     <span class=\"gcb-tag\">AI Agent<\/span><br \/>\n     <span class=\"gcb-tag\">\u591a\u6a21\u6001<\/span><br \/>\n     <span class=\"gcb-tag\">\u8bed\u97f3<\/span><br \/>\n     <span class=\"gcb-tag\">AI \u5e94\u7528<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">MCP Python SDK \u670d\u52a1\u7aef\u5de5\u5177&#xff08;Tools&#xff09;\u5f00\u53d1\u6307\u5357&#xff1a;\u7528 &#096;&#064;mcp.tool()&#096; \u628a\u666e\u901a Python \u51fd\u6570\u53d8\u6210\u6a21\u578b\u53ef\u8c03\u7528\u7684\u5de5\u5177<\/h5>\n<p class=\"gcb-related-item-desc\">MCP Python SDK \u670d\u52a1\u7aef\u5de5\u5177&#xff08;Tools&#xff09;\u5f00\u53d1\u6307\u5357&#xff1a;\u7528 &#064;mcp.tool \u628a\u666e\u901a Python \u51fd\u6570\u53d8\u6210\u6a21\u578b\u53ef\u8c03\u7528\u7684\u5de5\u5177 \u672c\u6307\u5357\u57fa\u4e8e python<\/p>\n<p>     <span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span><br \/>\n     <span class=\"gcb-tag\">AI Agent<\/span><br \/>\n     <span class=\"gcb-tag\">\u591a\u6a21\u6001<\/span><br \/>\n     <span class=\"gcb-tag\">\u8bed\u97f3<\/span><br \/>\n     <span class=\"gcb-tag\">AI \u5e94\u7528<\/span>\n      <\/li>\n<\/ul>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0a\u4e00\u7bc7&#xff1a;<\/span><br \/>\n  \u53d8\u91cf\u547d\u540d\u4ece\u672a\u5982\u6b64\u7b80\u5355&#xff01;vscode-comment-translate\u7ffb\u8bd1\u66ff\u6362\u529f\u80fd\u5b9e\u6218\u6559\u7a0b <\/p>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0b\u4e00\u7bc7&#xff1a;<\/span><br \/>\n  AutoUpdater.NET&#xff1a;5\u6b65\u5b9e\u73b0.NET\u684c\u9762\u5e94\u7528\u81ea\u52a8\u66f4\u65b0\u7ec8\u6781\u6307\u5357 <\/p>\n<p>\u521b\u4f5c\u58f0\u660e\uff1a\u672c\u6587\u90e8\u5206\u5185\u5bb9\u7531AI\u8f85\u52a9\u751f\u6210\uff08AIGC\uff09\uff0c\u4ec5\u4f9b\u53c2\u8003<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eba\u5de5\u667a\u80fdAI Agent\u591a\u6a21\u6001\u8bed\u97f3AI \u5e94\u7528 \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011ten-framework Open-source framework for conversational voice AI agents \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/TEN-framework\/ten-framework \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d  \u5bfc\u8bfb<br \/>\nminimal-http-server \u662f libwebsockets&#xff08;lws&#xff09;\u5b98\u65b9\u793a\u4f8b\u96c6\u4e2d\u6700\u7b80<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-115043","post","type-post","status-publish","format-standard","hentry","category-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u57fa\u4e8e libwebsockets \u6784\u5efa\u6700\u5c0f HTTP \u670d\u52a1\u5668\uff1aminimal-http-server \u793a\u4f8b\u5168\u89e3\u6790\uff08TEN-framework \u96c6\u6210\u89c6\u89d2\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/115043.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u57fa\u4e8e libwebsockets \u6784\u5efa\u6700\u5c0f HTTP \u670d\u52a1\u5668\uff1aminimal-http-server \u793a\u4f8b\u5168\u89e3\u6790\uff08TEN-framework \u96c6\u6210\u89c6\u89d2\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4eba\u5de5\u667a\u80fdAI Agent\u591a\u6a21\u6001\u8bed\u97f3AI \u5e94\u7528 \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011ten-framework Open-source framework for conversational voice AI agents \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/TEN-framework\/ten-framework \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d \u5bfc\u8bfb minimal-http-server \u662f libwebsockets&#xff08;lws&#xff09;\u5b98\u65b9\u793a\u4f8b\u96c6\u4e2d\u6700\u7b80\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/115043.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-10T16:10:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010161014-6aca6366e5b21.svg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115043.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/115043.html\",\"name\":\"\u57fa\u4e8e libwebsockets \u6784\u5efa\u6700\u5c0f HTTP \u670d\u52a1\u5668\uff1aminimal-http-server \u793a\u4f8b\u5168\u89e3\u6790\uff08TEN-framework \u96c6\u6210\u89c6\u89d2\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-10T16:10:15+00:00\",\"dateModified\":\"2026-10-10T16:10:15+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/115043.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/115043.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/115043.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u57fa\u4e8e libwebsockets \u6784\u5efa\u6700\u5c0f HTTP \u670d\u52a1\u5668\uff1aminimal-http-server \u793a\u4f8b\u5168\u89e3\u6790\uff08TEN-framework \u96c6\u6210\u89c6\u89d2\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u57fa\u4e8e libwebsockets \u6784\u5efa\u6700\u5c0f HTTP \u670d\u52a1\u5668\uff1aminimal-http-server \u793a\u4f8b\u5168\u89e3\u6790\uff08TEN-framework \u96c6\u6210\u89c6\u89d2\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/115043.html","og_locale":"zh_CN","og_type":"article","og_title":"\u57fa\u4e8e libwebsockets \u6784\u5efa\u6700\u5c0f HTTP \u670d\u52a1\u5668\uff1aminimal-http-server \u793a\u4f8b\u5168\u89e3\u6790\uff08TEN-framework \u96c6\u6210\u89c6\u89d2\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4eba\u5de5\u667a\u80fdAI Agent\u591a\u6a21\u6001\u8bed\u97f3AI \u5e94\u7528 \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011ten-framework Open-source framework for conversational voice AI agents \u9879\u76ee\u5730\u5740&#xff1a; https:\/\/gitcode.com\/TEN-framework\/ten-framework \u70b9\u51fb\u67e5\u770b \u514d\u8d39\u4e0b\u8f7d \u5bfc\u8bfb minimal-http-server \u662f libwebsockets&#xff08;lws&#xff09;\u5b98\u65b9\u793a\u4f8b\u96c6\u4e2d\u6700\u7b80","og_url":"https:\/\/www.wsisp.com\/helps\/115043.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-10T16:10:15+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010161014-6aca6366e5b21.svg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/115043.html","url":"https:\/\/www.wsisp.com\/helps\/115043.html","name":"\u57fa\u4e8e libwebsockets \u6784\u5efa\u6700\u5c0f HTTP \u670d\u52a1\u5668\uff1aminimal-http-server \u793a\u4f8b\u5168\u89e3\u6790\uff08TEN-framework \u96c6\u6210\u89c6\u89d2\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-10T16:10:15+00:00","dateModified":"2026-10-10T16:10:15+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/115043.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/115043.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/115043.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u57fa\u4e8e libwebsockets \u6784\u5efa\u6700\u5c0f HTTP \u670d\u52a1\u5668\uff1aminimal-http-server \u793a\u4f8b\u5168\u89e3\u6790\uff08TEN-framework \u96c6\u6210\u89c6\u89d2\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=115043"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/115043\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=115043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=115043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=115043"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=115043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}