title: How do I use a self signed certificate file to connect to a websocket in React Native?
body: <p>I have a self signed certificate file(Let's call it cert.pem) and I would like to connect to my ssl encrypted server with my react native app(I'm using expo, if that is relevant). I can do this in python using the following lines of code:</p>
  <pre><code>uri = &quot;wss://{hostname}:{port}&quot;
  ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
  ssl_context.load_verify_locations(&quot;cert.pem&quot;)
  websocket = websockets.connect(uri, ssl=ssl_context)
  </code></pre>
  <p>Essentially, I would like to replicate this behavior in my react native app. I am trying to use  <code>var ws = new WebSocket(...arguments...)</code>, but I am not sure what arguments I should use to connect to my server. If there is a better way than using the <code>WebSockets()</code> constructor, please let me know.</p>