Right now our team is using self-signed certificates for testing and socket io for communication.
To use custom certificate validation the solution I've found is:
var socket = new SocketIOClient.SocketIO("https://localhost:8443") {
HttpClient = new DefaultHttpClient2()
};
socket.ClientWebSocketProvider = () => new DefaultClientWebSocket2();
await socket.ConnectAsync();
// ...
Where DefaultHttpClient2 and ClientWebSocket2 are the exact same classes as their definition on github with the following changes:
public DefaultClientWebSocket2() {
_ws = new ClientWebSocket();
_ws.Options.RemoteCertificateValidationCallback = CUSTOM_PREDICATE;
}
public DefaultHttpClient2() {
_handler = new HttpClientHandler();
_handler.ServerCertificateCustomValidationCallback = CUSTOM_PREDICATE;
_httpClient = new HttpClient(_handler);
}
This works for version 3.1.1, is there a better way to provide a predicate that will reach both the http client and the web socket client?
Right now our team is using self-signed certificates for testing and socket io for communication. To use custom certificate validation the solution I've found is:
Where DefaultHttpClient2 and ClientWebSocket2 are the exact same classes as their definition on github with the following changes:
This works for version 3.1.1, is there a better way to provide a predicate that will reach both the http client and the web socket client?