How to connect SSL websocket with mqtt? - javascript

I created a self signed certificate and I've been working on the mqtt websockets over SSL/TSL, however I'm unsure exactly where I made an error. On my terminal websocket is open and sends out CONNACK/SUBSCRIBE/PUBLISH etc...
However when I opened up my chrome console log, I got an error saying that
"websocket connection to 'wss:.//hostname:9001/mqtt' failed: Error in connection establishment: net: ERR_CERT_AUTHORITY_INVALID
My time is synchronised correctly, and I'm either thinking my certificate has an error or chrome doesn't accept it but if my certificate error, wouldn't it have given an error when I first tried it on regular mosquitto_sub?
Any tips?
Thank you

Related

What is error net::ERR_CONNECTION_REFUSED?

Failed to load resource:
net::ERR_CONNECTION_REFUSED?
It means exactly what it says.
You tried to connect to something over the network. The system you were connecting to refused to accept the connection.
Usually this is because there isn't a service listening on the port you tried to connect to. Sometimes the connection is blocked by a firewall.

Nodemailer Error that may be result of port error?

I'm using Nodemailer and I get an error that I can't seem to solve. Some sites say it's my firewall blocking ports, I opened the ports and used different ports, didn't solve much.
Below are logs of the errors Nodemailer emitted.
[2020-10-07 03:38:23] DEBUG Creating transport: nodemailer (6.4.13; +https://nodemailer.com/; SMTP/6.4.13[client:6.4.13])
[2020-10-07 03:38:23] DEBUG Sending mail using SMTP/6.4.13[client:6.4.13]
[2020-10-07 03:38:23] DEBUG [TNYM4ZexJbo] Resolved smtp.mailtrap.io as 34.224.73.100 [cache miss]
[2020-10-07 03:38:44] ERROR [TNYM4ZexJbo] connect EACCES 34.224.73.100:25
[2020-10-07 03:38:44] DEBUG [TNYM4ZexJbo] Closing connection to the server using "destroy"
[2020-10-07 03:38:44] ERROR Send Error: connect EACCES 34.224.73.100:25

An SSL certificate error occurred when fetching the script. (messaging/failed-serviceworker-registration)

I am testing my web app on localhost for firebase cloud messaging.
I am running it on a virtual host and I enabled SSL for it, I can see https but it is crossed in red. I searched and tried two methods but none of them are working
.\chrome.exe --ignore-certificate-errors --unsafely-treat-insecure-origin-as-secure=https://firebase_notification.test
Also,
chrome://flags/#allow-insecure-localhost enable this flag
I am still getting the same error.
An SSL certificate error occurred when fetching the script.
get-notifications:57 An error occurred while retrieving token. FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker: An SSL certificate error occurred when fetching the script. (messaging/failed-serviceworker-registration).
at https://www.gstatic.com/firebasejs/6.3.4/firebase-messaging.js:1:30787

How to get NET errors in Javascript

When using WebSocket to open my wss I sometimes see in the browser console ...
foo.js:557 WebSocket connection to 'wss://:9002/changes' failed: Error in connection establishment: net::ERR_CERT_AUTHORITY_INVALID
Other times I see...
WebSocket connection to 'wss://:9002/changes' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
However, in either case the onclose event is code 1006. Is there anyway in JavaScript I can differentiate between the invalid certificate and the down connection?

Fail to connect Mongolab with MongodbShell

I'm trying to connect the Mongo shell with Mongolab. I am using my mongolab username and password but it is giving an error: "Failed to connect to 54.81.180.188:56789."
My userName and password is correct.
I'm using Windows 8.1
When I ping ds0-----.mongolab.com that's working fine.
C:\mongodb\bin>mongo ds0----.mongolab.com:56789/dbname -u "MyUserName" -p "MyPassword"
MongoDB shell version: 3.0.3
connecting to: ds027751.mongolab.com:56789/dbname
2015-06-05T10:55:30.019+0530 W NETWORK Failed to connect to 54.81.180.188:56789, reason: errno:10061 No connection could be made because the target machine actively refused it.
2015-06-05T10:55:30.024+0530 E QUERY Error: couldn't connect to server ds027751.mongolab.com:56789 (54.81.180.188), connection attempt failed
at connect (src/mongo/shell/mongo.js:181:14)
at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed
I had the same problem, my server abruptly lost the ability to connect to MongoLab. I contacted support, who sent this reply:
Hello,
Your Experimental Sandbox plan is running MongoDB 3.0.x, which
includes changes to Mongo's authentication mechanism. This new
mechanism is supported by certain newer driver versions, as described
at
http://docs.mongodb.org/manual/release-notes/3.0-scram/#upgrade-drivers.
To connect to this database, you will need to use one of the drivers
listed at the above link.
Please let us know if you have questions about this.
Sincerely, Samson
I assume I was upgraded automatically, as I hadn't touched the server code or MongoLab in months. As an immediate fix, I just created a new db in MongoLab, which was created in mongod v2.6.9 (I don't remember seeing an option to choose the version).

Categories