add unix domain socket support for websocket (#1486)

This commit is contained in:
Young-Flash
2022-09-26 15:45:04 +02:00
committed by GitHub
parent 01a394cf5f
commit 88a3e9aa0e
2 changed files with 17 additions and 0 deletions
+12
View File
@@ -533,6 +533,18 @@ public:
return std::move(*this);
}
/* options, callback, path to unix domain socket */
TemplatedApp &&listen(int options, MoveOnlyFunction<void(us_listen_socket_t *)> &&handler, std::string path) {
handler(httpContext ? httpContext->listen(path.c_str(), options) : nullptr);
return std::move(*this);
}
/* callback, path to unix domain socket */
TemplatedApp &&listen(MoveOnlyFunction<void(us_listen_socket_t *)> &&handler, std::string path) {
handler(httpContext ? httpContext->listen(path.c_str(), 0) : nullptr);
return std::move(*this);
}
TemplatedApp &&run() {
uWS::run();
return std::move(*this);
+5
View File
@@ -445,6 +445,11 @@ public:
us_listen_socket_t *listen(const char *host, int port, int options) {
return us_socket_context_listen(SSL, getSocketContext(), host, port, options, sizeof(HttpResponseData<SSL>));
}
/* Listen to unix domain socket using this HttpContext */
us_listen_socket_t *listen(const char *path, int options) {
return us_socket_context_listen_unix(SSL, getSocketContext(), path, options, sizeof(HttpResponseData<SSL>));
}
};
}