javascript - Disconnect a jquery connection after an inactivity period -


i'm using tcp keepalive on server side keep connection alive, , notify server if client dies. how can configure jquery.get() disconnect connection after period of idle time?

edit - consider "idle time" time no tcp packets exchanged. since server has tcp keepalive, send 0-data packets client.

@j-p's answer not exact match want. if connection open, has keep-alive traffic no data, keep open indefinitely.

use timeout option:

jquery.ajax({     url: '...',     timeout: 3000,     success: function(){ /*...*/ } }); 

or, if want same timeout requests:

$.ajaxsetup({     timeout: 3000 }); 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

What's the encoding type of Android 2.2 push message? -

visual studio - Deleting lines of code in a text editor -