question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create connection to SSL with rejectUnauthorized: true

See original GitHub issue

Hi, how can I connect to socket.IO with SSL and selfsigned certificate? In JS code I use this:

const socket = io.connect(urlToBridge, {
    extraHeaders: {
        token: tokenFromUser,   
    },
    rejectUnauthorized : false,
    secure: true,
   
});

In csharp I do not know how to add rejectUnauthorized and secure true.

 var client = new SocketIO("https://localhost:443", new SocketIOOptions
            {
                ExtraHeaders = new Dictionary<string, string>
                {
                    {"type", "server" },
                    {"token", tokenFromUser
                },               
            });

Thanks

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bhemalacommented, Dec 3, 2021

Hi @sitihawasabri, for .NET Framework I do not use client.ClientWebSocketProvider. I skipped this part and use System.Net.ServicePointManager.ServerCertificateValidationCallback instead.

var client = new SocketIO("http://localhost:11000/");
 System.Net.ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =>
    {
        Console.WriteLine(sslPolicyErrors);
        // Note it will ignore all SSL errors
        return true;
    };
0reactions
sitihawasabricommented, Dec 3, 2021

Okay noted, thank you so much!

Read more comments on GitHub >

github_iconTop Results From Across the Web

true" a valid option to connect to a mysql server using ssl - ...
Since if ssl = true , then ssl.rejectUnauthorized is undefined , which is falsy but not false . The expression this.ssl.rejectUnauthorized !==
Read more >
no way to set rejectUnauthorized from pg-connection-string
Now that rejectUnauthorized is being defaulted to true, there is no way to modify that from the connection string.
Read more >
How to Resolve Certificate Errors in a NodeJS App with SSL ...
The easiest solution to resolve these errors is to use the “ rejectUnauthorized ” option as below. ... However, this method is unsafe...
Read more >
Locally resolved domains ssl - rejectUnauthorized: true ...
I configured cassandra to ssl and i can connect to it via cqlsh --ssl. If I try to connect via nodejs driver it...
Read more >
Connecting TypeORM / node-pg to a postgres database on ...
This behaviour may be disabled by changing rejectUnauthorized: false in the ssl configuration. Using TypeORM createConnection ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found