title: Android: How to use Gottox/socket.io-java-client library with right way?
body: <p>I have a service. I create a <code>Thread</code> for using <code>socket.io-java-client</code> library on separate thread in this Service.</p>
  
  <p>I keep thread with following way:</p>
  
  <pre><code>@Override
  public void run() {
      while (canLiveThread) {
      //  keep thread
      }
  }
  </code></pre>
  
  <p>And this way fully wrong yes? To fix this solution I need find answer to following questions:</p>
  
  <p><strong>1.</strong> Are need to me create separately thread to use socket.io-java-client library in Service? Or I can use this library without thread, simply implement socket.io-java-client library in Service?</p>
  
  <p><strong>2.</strong> If need create thread to use this library, then how to manage thread with right way to not draining battery in background Service?</p>
  
  <p>If anybody have any Solution, please answer to this question ...</p>
  
  <p>Thanks in Advance!</p>