pusher / pusher-websocket-dotnet

Pusher Channels Client Library for .NET
MIT License
111 stars 113 forks source link

RemoteCertificateChainErrors with PusherClient in Xamarin forms #117

Closed ValJoly closed 2 years ago

ValJoly commented 2 years ago

I try to connect to a websocket in my Xamarin.Forms app but when I try to ConnectAsync() I got an error on android that look like this :

Pusher Error: WebSocket error emitted:
RemoteCertificateChainErrors
PusherClient.WebsocketException: WebSocket error emitted:
RemoteCertificateChainErrors ---> System.Exception: RemoteCertificateChainErrors
   --- End of inner exception stack trace ---

This error is log when I try to connect with this kind of code :

ClientSocket = new Pusher("myappkey", new PusherOptions
{
    Host = "ws.my-custom-domain.fr",
    Encrypted = true,

    Authorizer = new CUstomAuthorizer("https://my-custom-domain.fr/broadcasting/auth", Token.AccessToken),

});

ClientSocket.ConnectionStateChanged += PusherConnectionStateChanged;
ClientSocket.Error += PusherError;

await ClientSocket.ConnectAsync().ConfigureAwait(false);

My probleme is that the certificate used here is the same as the API that I call without probleme less than a minute ago. This probleme seem to appere only on android devices Thanks for help

benw-pusher commented 2 years ago

It looks as though you are using a custom websocket host and not the official Pusher service, is this correct? The error indicated an issue validating the certificates of the websocket host, so you will need to ensure your service has the correct certificates and that your device recognises the full certificate chain.

ValJoly commented 2 years ago

Yes this is it I use a custom Host but as I said it's the same certificate that the API I use in the same time and there is no problem with this part so I don't understant why. But if you have a clue to do this verification that you are talking about, I clearly love that you explain it to me ! @benw-pusher

benw-pusher commented 2 years ago

This library is designed for use with the Pusher Channels service and we can't provide support for connecting to a custom websocket host.

ThomasBernardPageUp commented 2 years ago

I have the same error, have you found a solution ? @ValJoly