Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose native_tls as it's needed to use your API #247

Merged
merged 1 commit into from
Oct 1, 2020

Conversation

levelonedev
Copy link
Contributor

In order to use any of the connect functions I would be required to depend on native_tls directly. It would be easier if you exposed the version you depend on.

use native_tls::TlsConnector; //Errors out currently
use websocket::native_tls::{TlsConnector, Certificate}; //What I propose

let mut file = File::open("cert.pem")?;
let mut data:Vec<u8> = Vec::new();
file.read_to_end(&mut data);
let root_ca = Certificate::from_pem(&data)?;
let connector = TlsConnector::builder().add_root_certificate(root_ca).build()?;

let mut builder: ClientBuilder = ClientBuilder::from_url(&self.url);
let mut client = builder.connect(Some(connector))?;

@vi vi merged commit b78d08b into websockets-rs:master Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants