title: How do I keep PostgreSQL connection open?
body: <p>So basicly I create my db client like this:</p>
  
  <pre><code>client = new pg.Client(conString);
  client.connect();
  </code></pre>
  
  <p>but after some time of innactivity on the db, the clients probably drops the connection and gives me this error:</p>
  
  <pre><code>"Error: read ECONNRESET"
  </code></pre>
  
  <p>I tried doing this to keep it open:</p>
  
  <pre><code>db.client.on('error', function(e){        
      db.client.connect();
  });
  </code></pre>
  
  <p>But that doesn't work and I still get the error. Anyone dealt with this before and has any idea how to solve it?</p>