# How to connect the event broker using ssl connection?

**URL:** <https://community.solace.com/t/how-to-connect-the-event-broker-using-ssl-connection/1264>\
**Category:** Solace Event Broker\
**Tags:** cli\
**Created:** [May 16, 2022, 9:06am UTC](https://community.solace.com/t/how-to-connect-the-event-broker-using-ssl-connection/1264 "2022-05-16T09:06:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![loooool](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/loooool/32/1140_2.png) [@loooool](https://community.solace.com/u/loooool)\
**Post date:** [May 16, 2022, 9:06am UTC](https://community.solace.com/t/how-to-connect-the-event-broker-using-ssl-connection/1264/1 "2022-05-16T09:06:17Z")

</div>

Hello, solace team  
I am a beginner and I want to ask some simple questions.  
I have created a PubSub+ Software Event Broker on my local docker following blew tutorial： [Docker Desktop for Windows](https://docs.solace.com/Software-Broker/SW-Broker-Set-Up/Containers/Set-Up-Docker-Container-Windows.htm)  
And I also connected to the broker using the node js tutorial as shown below:

 ![image.png](https://canada1.discourse-cdn.com/solace/original/1X/8cb0ab41494f9bbe3c308fc24a0516b0f3871131.png)  
And then I want to connect to the event broker by using SSL, I have uploaded the self-signed certificate and it looks like it’s working：  
 ![image.png](https://canada1.discourse-cdn.com/solace/original/1X/ae9adf4ddde40014f02ee7a7852791078eaa1b95.png)  
I want to connect to port 8007 using SSL, so I replaced the above command and replaced ws://localhost:8008 with wss://localhost:8007 but it’s not working.  
 ![image.png](https://canada1.discourse-cdn.com/solace/original/2X/f/f62255f0f45b8139acec287a74881411220a9870.png)  
So my question is are there any tutorials or tools to connect to? Forgive my stupid question as I don’t have any background, thanks for the answer.

---

<div class="post-metadata">

**Author:** ![amackenzie](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/amackenzie/32/1168_2.png) [@amackenzie](https://community.solace.com/u/amackenzie)\
**Post date:** [May 16, 2022, 10:57am UTC](https://community.solace.com/t/how-to-connect-the-event-broker-using-ssl-connection/1264/2 "2022-05-16T10:57:42Z")

</div>

Hi,  
If it’s a self-signed certificate, you need to tell the API where the public cert is with the `sslTrustStores` property that points to your local PEM.  
You can find a sample here:

> <https://github.com/SolaceSamples/solace-samples-nodejs/blob/master/src/features/SecureSession.js>

---

<div class="post-metadata">

**Author:** ![loooool](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/loooool/32/1140_2.png) [@loooool](https://community.solace.com/u/loooool)\
**Post date:** [May 17, 2022, 10:36am UTC](https://community.solace.com/t/how-to-connect-the-event-broker-using-ssl-connection/1264/3 "2022-05-17T10:36:59Z")

</div>

> Hello again,  
> Following your tip yesterday, I used the scuresession.js file. And I created a Private Certificate Authority using this command:  
> openssl req -newkey rsa:2048 -nodes -keyout MyRootCaKey.pem -x509 -days 365 -out MyRootCaCert.pem  
> Then I created a certificate using blew command:  
> openssl genrsa -out client1.pem 2048  
> openssl req -new -key client1.pem -out MyClient1.csr  
> openssl x509 -req -in MyClient1.csr -CA MyRootCaCert.pem -CAkey MyRootCaKey.pem -CAcreateserial  
> Knowing that at that time, I created a total of 4 files ：
> 
> ![image.png](https://canada1.discourse-cdn.com/solace/original/1X/744d5c4541720ce5725b1b496b5fde240f6a1fe4.png)  
> Then I merged client1.pem and clientCert1.pem and uploaded it. And the port1443 is also not abnormal:  
> ![image.png](https://canada1.discourse-cdn.com/solace/original/1X/94dae358b59d9dabc5467f1edee955c12db04a8f.png)  
> Next, I pointed to these files in scuresession.js file.  
> ![image.png](https://canada1.discourse-cdn.com/solace/original/1X/81518e0aaa88718455087937ea8257e44e58c634.png)  
> But when I connect to port1443, it still doesn’t work.  
> ![image.png](https://canada1.discourse-cdn.com/solace/original/2X/7/786a2ef9b63d254a897a988d8b0fe6b43c4c4f10.png)  
> Is there any error in my operation?  
> Thank you very much.
