add unix domain socket support for websocket (#1486)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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>));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user