简体   繁体   中英

Handle a HTTPS WebSocket handshake in C#

I have a local c# server running and listening on localhost and a browser connecting to a cloud service running a JavaScript HTML5 implementation of websockets. Standard ws://

This works great over HTTP:// and I can read the header and use it, but I need it to run in HTTPS:// I understand that I have to change to wss:// and this does connect to my server but the header is garbled/encrypted. I have looked into SslStream but drawn a blank.

How do I handle this WebSocket Secure header in C#?

This question was answered in the comments:

If your app is behind a Proxy load balancer, it would normally manage the SSL for you (accessing your app without encryption).

If you need to manage SSL, complete the SSL handshake first (usually right after you accept the connection) and than parse protocol specific data (HTTP, Websockets, SMTP etc').

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