title: Manually track WCF client's inactivity time
body: <p>I have a <code>WCF</code> client that need to close its connection to the server in case no call has been made for more than X seconds.
  My server have a long <code>inactivityTimeout</code> which I cannot change (the only changes I can make are in the client's side)</p>
  
  <p>After reading I understood that i cannot use <code>WCF's</code> configuration in order to do it so I thought of tracking the time between the calls that my <code>WCF</code> client is making manually.
  In case the client hasn't made a call for more than X seconds I will close that connection.</p>
  
  <p>I thought of 2 ways to implement it but I don't like either of them:</p>
  
  <ol>
  <li><p>Add some code to all my functions that will save the call time.</p></li>
  <li><p>Using <code>IClientMessageInspector</code> - in that case I will need to send the time of the call to an external class that will save this data and in time will call the client in case it recognizes that a call to the server haven't been made for a X seconds.</p></li>
  </ol>
  
  <p>I am looking for a simple solution like an event that will get called on each call to the server so all the logic of the time tracking the disconnection will happen in the same class (the <code>WCF's</code> client code) or maybe some way to use <code>WCF's</code> configuration so it will automatically close the connection in case of inactivity of more than X seconds.</p>
  
  <p>The binding I am using is <code>netTcpBinding</code> with a <code>reliableSession</code></p>
  
  <p>Any ideas on how to implement it ? </p>