# HG changeset patch # User Waqas Hussain # Date 1382629978 14400 # Node ID a234ad611633076ca055b56abb42028ea48b2bf9 # Parent 544f5a4a8428c93062f4f75294b6927f29c7d904 mod_component_client: Add config option component_client.keepalive_interval (default is one hour: 3600). diff -r 544f5a4a8428 -r a234ad611633 mod_component_client/mod_component_client.lua --- a/mod_component_client/mod_component_client.lua Tue Aug 13 21:55:13 2013 +0200 +++ b/mod_component_client/mod_component_client.lua Thu Oct 24 11:52:58 2013 -0400 @@ -37,6 +37,7 @@ local server_port = config.port or 5347; local server_secret = config.secret or error("client_component.secret not provided"); local exit_on_disconnect = config.exit_on_disconnect; +local keepalive_interval = config.keepalive_interval or 3600; local __conn; @@ -218,6 +219,16 @@ end end +-- send whitespace keep-alive one an hour +if keepalive_interval ~= 0 then + module:add_timer(keepalive_interval, function() + if __conn then + __conn:write(" "); + end + return keepalive_interval; + end); +end + function connect() ------------------------ -- Taken from net.http