title: Secure WebSocket server in Android
body: <p>I am using the <a href="https://github.com/koush/AndroidAsync" rel="nofollow">AndroidAsync</a> library from GitHub that is provided by koush.  I need this library to create a WebSocket server and I was able to create it.</p>
  
  <pre><code>private static List&lt;WebSocket&gt; webSockets = new ArrayList&lt;WebSocket&gt;();
  private static AsyncHttpServer httpServer = new AsyncHttpServer();
  </code></pre>
  
  <p>Here's the implementation: </p>
  
  <pre><code>public static void createWebSocket() {
      httpServer.websocket("/", new AsyncHttpServer.WebSocketRequestCallback() {
          @Override
          public void onConnected(final WebSocket webSocket, AsyncHttpServerRequest request) {
              webSockets.add(webSocket);
  
              webSocket.setClosedCallback(new CompletedCallback() {
                  @Override
                  public void onCompleted(Exception ex) {
                      Log.d(TAG, "onCompleted");
                  }
              });
  
              webSocket.setStringCallback(new WebSocket.StringCallback() {
                  @Override
                  public void onStringAvailable(String s) {
                      Log.d(TAG, "onStringAvailable");
                  }
              });
          }
      });
  
      httpServer.listen(8080);
  }
  </code></pre>
  
  <p>This implementation works completely fine.
  But I want to use the <code>wss</code> protocol where I can use a JKS (Java KeyStore) certificate for the websocket.</p>
  
  <p>Is there any way to do this? If not with this library, is there any other library I can use? Any example would be really appreciated.</p>
  
  <p>Thank you!!</p>