mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00

This adds a new member to the context creation info struct "ws_ping_pong_interval". If nonzero, it sets the number of seconds that established ws connections are allowed to be idle before a PING is forced to be sent. If zero (the default) then tracking of idle connection is disabled for backwards compatibility. Timeouts cover both the period between decision to send the ping and it being sent (because it needs the socket to become writeable), and the period between the ping being sent and the PONG coming back. INFO debug logs are issues when the timeout stuff is operating. You can test the server side by running the test server hacked to set ws_ping_pong_interval and debug log mask of 15. Both the mirror protocol and the server-status protocol are idle if nothing is happening and will trigger the PING / PONG testing. (You can also test using lwsws and /etc/lwsws/conf with "ws-pingpong-secs": "20" in the global section) For client, run the test client with -n -P 20 for 20s interval. -n stops the test client writing using the mirror protocol, so it will be idle and trigger the PING / PONGs. The timeout interval may be up to +10s late, as lws checks for affected connections every 10s.
164 lines
6.7 KiB
HTML
164 lines
6.7 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.11"/>
|
|
<title>libwebsockets: Connection timeouts</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(initResizable);
|
|
$(window).load(resizeHeight);
|
|
</script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectlogo"><img alt="Logo" src="libwebsockets.org-logo.png"/></td>
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">libwebsockets
|
|
</div>
|
|
<div id="projectbrief">Lightweight C library for HTML5 websockets</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.11 -->
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li class="current"><a href="modules.html"><span>Modules</span></a></li>
|
|
<li><a href="annotated.html"><span>Data Structures</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){initNavTree('group__timeout.html','');});
|
|
</script>
|
|
<div id="doc-content">
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#enum-members">Enumerations</a> |
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">Connection timeouts</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
|
|
Enumerations</h2></td></tr>
|
|
<tr class="memitem:ga2c0aa4b9c3c55bae7b35cbfac3246c87"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga2c0aa4b9c3c55bae7b35cbfac3246c87"></a>enum  </td><td class="memItemRight" valign="bottom"><b>pending_timeout</b> { <br />
|
|
  <b>NO_PENDING_TIMEOUT</b> = 0,
|
|
<b>PENDING_TIMEOUT_AWAITING_PROXY_RESPONSE</b> = 1,
|
|
<b>PENDING_TIMEOUT_AWAITING_CONNECT_RESPONSE</b> = 2,
|
|
<b>PENDING_TIMEOUT_ESTABLISH_WITH_SERVER</b> = 3,
|
|
<br />
|
|
  <b>PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE</b> = 4,
|
|
<b>PENDING_TIMEOUT_AWAITING_PING</b> = 5,
|
|
<b>PENDING_TIMEOUT_CLOSE_ACK</b> = 6,
|
|
<b>PENDING_TIMEOUT_AWAITING_EXTENSION_CONNECT_RESPONSE</b> = 7,
|
|
<br />
|
|
  <b>PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE</b> = 8,
|
|
<b>PENDING_TIMEOUT_SSL_ACCEPT</b> = 9,
|
|
<b>PENDING_TIMEOUT_HTTP_CONTENT</b> = 10,
|
|
<b>PENDING_TIMEOUT_AWAITING_CLIENT_HS_SEND</b> = 11,
|
|
<br />
|
|
  <b>PENDING_FLUSH_STORED_SEND_BEFORE_CLOSE</b> = 12,
|
|
<b>PENDING_TIMEOUT_SHUTDOWN_FLUSH</b> = 13,
|
|
<b>PENDING_TIMEOUT_CGI</b> = 14,
|
|
<b>PENDING_TIMEOUT_HTTP_KEEPALIVE_IDLE</b> = 15,
|
|
<br />
|
|
  <b>PENDING_TIMEOUT_WS_PONG_CHECK_SEND_PING</b> = 16,
|
|
<b>PENDING_TIMEOUT_WS_PONG_CHECK_GET_PONG</b> = 17
|
|
<br />
|
|
}</td></tr>
|
|
<tr class="separator:ga2c0aa4b9c3c55bae7b35cbfac3246c87"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:gaced9f9237f6172fed9f730a2af51345a"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__timeout.html#gaced9f9237f6172fed9f730a2af51345a">lws_set_timeout</a> (struct lws *wsi, enum pending_timeout reason, int secs)</td></tr>
|
|
<tr class="separator:gaced9f9237f6172fed9f730a2af51345a"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<p>APIs related to setting connection timeouts </p>
|
|
<h2 class="groupheader">Function Documentation</h2>
|
|
<a class="anchor" id="gaced9f9237f6172fed9f730a2af51345a"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">LWS_VISIBLE LWS_EXTERN void lws_set_timeout </td>
|
|
<td>(</td>
|
|
<td class="paramtype">struct lws * </td>
|
|
<td class="paramname"><em>wsi</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">enum pending_timeout </td>
|
|
<td class="paramname"><em>reason</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>secs</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p><code>#include <<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>></code></p>
|
|
<p><a class="el" href="group__timeout.html#gaced9f9237f6172fed9f730a2af51345a">lws_set_timeout()</a> - marks the wsi as subject to a timeout</p>
|
|
<p>You will not need this unless you are doing something special</p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">wsi</td><td>Websocket connection instance </td></tr>
|
|
<tr><td class="paramname">reason</td><td>timeout reason </td></tr>
|
|
<tr><td class="paramname">secs</td><td>how many seconds </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="footer">Generated by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|