Skip to content

Cannot establish WSS connection #149

@esso23

Description

@esso23

Hi Elad,
I have a problem when attempting to establish WSS connection between WampSharp client & WampSharp router. I have an unsigned certificate.

Client code:

var cert = new X509Certificate2(@"path/to/cert", "password");
var binding = new JTokenMsgpackBinding();
var ws = new WebSocket(location);
ws.Security.AllowNameMismatchCertificate = true;
ws.Security.AllowUnstrustedCertificate = true;
ws.Security.Certificates.Add(cert);
IControlledWampConnection<JToken> connection = new WebSocket4NetBinaryConnection<JToken>(ws, binding);
IWampChannel channel = channelFactory.CreateChannel("Default", connection, binding);
channel.Open().Wait();

Router code:

Host = new DefaultWampHost(mConfig.ServerAddress, new X509Certificate2(mConfig.CertificateLocation, password));

I tried doing it in many other different ways but it always crashes here and "connection is closed before it can be established":

        /// <summary>
        /// Call this when a new connection is established.
        /// </summary>
        /// <param name="connection">The new connection.</param>
        protected void OnNewConnection(TConnection connection)
        {
            string protocol = GetSubProtocol(connection);

            ConnectionListener listener;

            if (mBindings.TryGetValue(protocol, out listener))
            {
                listener.OnNewConnection(connection);
            }
            else
            {
                mLogger.ErrorFormat("No handler registered for protocol '{Protocol}'",
                                    protocol);
            }
        }

GetSubProtocol returns null (in TextBinaryTransport.cs), see pic:

subprotocol

Any help would be appreciated.
Thank you

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions