@ -413,6 +414,39 @@ var wssv = new WebSocketServer (4649, true);
wssv.Certificate = new X509Certificate2 ("/path/to/cert.pfx", "password for cert.pfx");
wssv.Certificate = new X509Certificate2 ("/path/to/cert.pfx", "password for cert.pfx");
```
```
### HTTP Authentication ###
**websocket-sharp** supports the HTTP Authentication (Basic/Digest).
As a **WebSocket Client**, you should set a pair of user name and password for the HTTP Authentication, using the `WebSocket.SetCredentials (username, password, preAuth)` method.
```cs
ws.SetCredentials ("nobita", "password", true);
```
If `preAuth` is `true`, the `WebSocket` sends the Basic authentication credentials in the first connection request.
And if `preAuth` is `false`, the `WebSocket` sends the Basic or Digest authentication credentials depend on the unauthorized response, in the second connection request.
As a **WebSocket Server**, you should set an HTTP authentication scheme, a realm, and any function to find the user credentials. It's like the following.