在C#中处理HTTPS WebSocket握手

时间:2015-08-13 12:16:54

标签: c# sockets ssl https websocket

我有一个本地c#服务器在localhost上运行和监听,以及一个浏览器连接到运行websockets的JavaScript HTML5实现的云服务。标准ws://

这比HTTP://更好用,我可以阅读标题并使用它,但我需要它在HTTPS://中运行我明白我必须更改为wss://这样做连接到我的服务器,但标头是乱码/加密。 我调查了SslStream但是画了一张空白。

如何在C#中处理此WebSocket Secure标头?

1 个答案:

答案 0 :(得分:0)

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').