Open NPPprojects opened 2 months ago
To anyone stuck on this, found a solution on the following forum: https://forum.unity.com/threads/how-to-allow-self-signed-certificate.522183/
Modified my code to https instead of wss and added the following:
public class WebSockets : MonoBehaviour
{
public SocketIOUnity socket;
private string serverUrlLink = "https://192.168.1.116:5000";
class NoCheckCertificatePolicy : System.Net.ICertificatePolicy {
public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem)
{
return true;
}
}
private void Awake()
{
System.Net.ServicePointManager.CertificatePolicy = new NoCheckCertificatePolicy();
}
// rest of code
I've made a self-signed certificate to make https requests to my WebSocket server. However, I can't find any options for setting certificates on the Unity client end. Is that possible? Here is my current client-side code:
Whenever I run this code, the client keeps trying to connect to the server and the server responds by outputting "accepted" repeatedly. Not running with certificates, the code runs fine.