Re: event_route[tcp:closed] and event_route[websocket:closed] not triggered on sudden WebSocket connection loss

Sergey Safarov via sr-users <[email protected]>
Newsgroups gmane.comp.voip.ser
Message-ID <CAHtxdDeKoi1D+vwij4xv1+-cZ78-MvrVW1ZFsf4KOoA6+8rAkw@mail.gmail.com>
Please show the PCAP recorded on the Kamailio side for traffic (connection)
from a mobile device.
With high probability, a TCP connection attempts to recover for 30 minutes.

Sergey

On Mon, Jul 14, 2025 at 3:15 PM fabien via sr-users <
[email protected]> wrote:

> Hello Kamailio community,
>
> I'm running Kamailio 5.8 with websocket and tcpops modules loaded.
>
> My setup:
> - websocket module configured with keepalive enabled:
>   modparam("websocket", "keepalive_mechanism", 1)
>   modparam("websocket", "keepalive_interval", 10)
>   modparam("websocket", "keepalive_timeout", 5)
>   modparam("websocket", "keepalive_processes", 2)
>   modparam("websocket", "timer_interval", 5)
>
> - tcpops module loaded with closed_event enabled:
>   loadmodule "tcpops.so"
>   modparam("tcpops", "closed_event", 1)
>
> - event_route[tcp:closed] implemented to catch socket closure and clean
> dialogs
> - dialog module loaded with dlg_flag = 4, and dialog tracking active on
> INVITE requests
>
> What works:
> - When I manually kill the WebSocket client, the event_route[tcp:closed]
> is triggered immediately.
>
> What doesn't work:
> - When the client loses network connectivity abruptly (e.g. mobile device
> loses 4G signal or Wi-Fi disconnects), the event_route[tcp:closed] is NOT
> triggered for several minutes (likely until TCP timeout).
> - I've tried reducing websocket keepalive_timeout to 5 seconds, but it
> does not speed up detection of lost connections.
> - I have confirmed that TCP keepalive settings on the OS are at default
> values and have not yet been tuned.
>
> My questions:
> 1. Is there any known limitation or delay in Kamailio's tcpops or
> websocket modules that could cause delayed detection of abrupt WebSocket
> disconnects?
> 2. Are there any best practices or additional mechanisms recommended to
> handle abrupt WebSocket disconnections faster, especially for SIP dialog
> cleanup?
> 3. Would adding SIP OPTIONS ping help detect dead clients sooner, and how
> would you recommend implementing this in Kamailio?
> 4. Any other suggestions to improve detection and cleanup of dead
> WebSocket SIP clients?
>
> Thanks in advance for your help and advice.
>
> Best regards,
> Fabien Brou
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions --
> [email protected]
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
>

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.