简体   繁体   中英

How to embed the certificate for the web socket in angular application

I am working on an application that is suppose to receive the data over web sockets. I haven't worked with socket data before.

I am trying to directly connect to web socket server over wss from my Angular application. This however throws an ERR_CERT_INVALID error.

I assume, I need to provide some detail to the server for authentication in form of certificate keys.

How can I pass these details directly from my Angular10 client while creating the connection. Is it even possible to pass these details while making a connection from browser or do I need to use an intermediate server?

Please suggest.

Validating the certificates for a connection is done inside the browser. There is no way for an Angular application to setup own certificate validation or add its own trusted certificates. To make it easy a publicly issued certificate should be used which automatically is checked and trusted by the browser. In case of a private certificate it would need to be explicitly added by all users to their browsers, ie there is no way to do this automatically from the Angular application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM