# How to use ssl connection with Javascript SDK?

**URL:** <https://forum.heroiclabs.com/t/how-to-use-ssl-connection-with-javascript-sdk/1970>\
**Category:** Local Setup\
**Tags:** server-framework\
**Created:** [September 22, 2021, 4:16pm UTC](https://forum.heroiclabs.com/t/how-to-use-ssl-connection-with-javascript-sdk/1970 "2021-09-22T16:16:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gandangf](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/gandangf/32/795_2.png) [@Gandangf](https://forum.heroiclabs.com/u/Gandangf)\
**Post date:** [September 22, 2021, 4:16pm UTC](https://forum.heroiclabs.com/t/how-to-use-ssl-connection-with-javascript-sdk/1970/1 "2021-09-22T16:16:09Z")

</div>

{Details}

1. Versions: Nakama {3.5}, {Windows, Mac, Linux binary or Docker}, {client library (SDK) and version}
2. Server Framework Runtime language (If relevant) {Go, TS/JS, Lua}

```auto
{code or log snippet}

```

📺 **Media:**

Hello Dev team.

I’m trying to use SSL connection and I think I’ve reached a dead end now.

I’m using cocos creator engine and my code is here.

```
var serverkey = "defaultkey";
var host = "61.75.75.168";
var port = "7350";
var useSSL = true;
var timeout = 5000; // ms
this._client = new _nakama.Client(serverkey, host, port, useSSL, timeout);

```

And for use ssl I make crt and key file with open ssl

req -config openssl.cnf -x509 -days 365 -key nakama.key -in nakama.csr -out nakama.crt -days 365

and I upload this to data folder in nakama server I copy this when docker is building. like this

COPY /data/nakama.crt /nakama/data/  
COPY /data/nakama.key /nakama/data/

and my yml file is here  
socket:  
ssl\_certificate: “/nakama/data/nakama.crt”  
ssl\_private\_key: “/nakama/data/nakama.key”

so. what is my problem?

when I set up this I encounter error like this.

![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/1X/093b665089f29e179158d72b34736201c71be2f6.png)

How can I use ssl connection?

I really need this.

Do I make some mistake?

---

<div class="post-metadata">

**Author:** ![lugehorsam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/lugehorsam/32/314_2.png) [@lugehorsam](https://forum.heroiclabs.com/u/lugehorsam)\
**Post date:** [September 26, 2021, 1:36pm UTC](https://forum.heroiclabs.com/t/how-to-use-ssl-connection-with-javascript-sdk/1970/2 "2021-09-26T13:36:20Z")

</div>

Hey @Gandangf it may bet that Chrome is rejecting your self-signed certificate.

Does your cert work in the Cocos simulator?
