Hi all,
The HTTP/HTTPS listener (listen-http / listen-https) currently uses a fixed 5-second idle timeout; I’d like to suggest adding a config option for it.
Issue:
The HTTP idle (keepalive) timeout for the HTTP/WS listener is not configurable. In practice it is fixed at 5 seconds (the libwebsockets default when keepalive_timeout is not set). That can be problematic when:
- A load balancer (e.g. AWS ALB) or client expects a longer idle timeout and closes connections before the next request.
- We want to align or tune the timeout for health checks or control traffic (e.g. NG over HTTP).
Root cause:
RTPEngine uses libwebsockets for HTTP/WS. The idle timeout is controlled by the vhost option keepalive_timeout in lws_context_creation_info when creating the vhost. In daemon/websocket.c, the context and vhost are created without setting this field, so libwebsockets uses its default (0 → 5 s for HTTP/1.1).
See e.g. libwebsockets’ include/libwebsockets/lws-context-vhost.h: “(default = 0 = 5s, 31s for http/2)”.
Proposed solution:
Add a config/CLI option (e.g. --http-idle-timeout or --http-keepalive-timeout, in seconds) and pass it into keepalive_timeout when creating the HTTP and HTTPS vhosts in websocket_init(). Keep the default at 0 so that existing deployments keep the current behaviour (LWS default 5 s).
I’d be happy to prepare a patch (including config-file and docs updates) if this direction works for the project.
Best regards,
Hossein