title: Keeping Socket Alive with Vapor 3
body: <p>I have a web socket in an app built using Vapor 3 that I have deployed to Heroku. The socket keeps closing. How do I keep the socket alive in Vapor 3? In Vapor 2, I used these lines of code. How would I do the same thing in Vapor 3?</p>
  
  <pre><code>background {
      while ws.state == .open {
          try? ws.ping()
          self.console.wait(seconds: 10) // every 10 seconds
      }
  }
  </code></pre>