@@ -25,8 +25,37 @@ namespace uWS {
2525 other.http3Context = nullptr ;
2626 }
2727
28- H3App &&listen(int port, std::function<void (void *)> cb) {
28+ /* Host, port, callback */
29+ H3App &&listen(std::string host, int port, MoveOnlyFunction<void (us_listen_socket_t *)> &&handler) {
30+ if (!host.length ()) {
31+ return listen (port, std::move (handler));
32+ }
33+ http3Context->listen ();
34+ // handler(httpContext ? httpContext->listen(host.c_str(), port, 0) : nullptr);
35+ return std::move (*this );
36+ }
37+
38+ /* Host, port, options, callback */
39+ H3App &&listen(std::string host, int port, int options, MoveOnlyFunction<void (us_listen_socket_t *)> &&handler) {
40+ if (!host.length ()) {
41+ return listen (port, options, std::move (handler));
42+ }
43+ http3Context->listen ();
44+ // handler(httpContext ? httpContext->listen(host.c_str(), port, options) : nullptr);
45+ return std::move (*this );
46+ }
47+
48+ /* Port, callback */
49+ H3App &&listen(int port, MoveOnlyFunction<void (us_listen_socket_t *)> &&handler) {
50+ http3Context->listen ();
51+ // handler(httpContext ? httpContext->listen(nullptr, port, 0) : nullptr);
52+ return std::move (*this );
53+ }
54+
55+ /* Port, options, callback */
56+ H3App &&listen(int port, int options, MoveOnlyFunction<void (us_listen_socket_t *)> &&handler) {
2957 http3Context->listen ();
58+ // handler(http3Context ? http3Context->listen(nullptr, port, options) : nullptr);
3059 return std::move (*this );
3160 }
3261
0 commit comments