How to use ssl connection with Javascript SDK?


  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}
{code or log snippet}

:tv: 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 = "";
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
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.


How can I use ssl connection?

I really need this.

Do I make some mistake?

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

Does your cert work in the Cocos simulator?