Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InMemoryTransport/Binding & WampAuthenticationHost #262

Closed
esso23 opened this issue Aug 9, 2018 · 2 comments
Closed

InMemoryTransport/Binding & WampAuthenticationHost #262

esso23 opened this issue Aug 9, 2018 · 2 comments

Comments

@esso23
Copy link

esso23 commented Aug 9, 2018

Hi again Elad,

I have another issue - when registering InMemoryBinding with WampAuthenticationHost, the call to RegisterTransport fails with:
System.ArgumentException: 'Got no binding. Expected at least one binding. Parameter name: bindings'
Apparently the problem is in WampAuthenticationHost.RegisterTransport:

IEnumerable<IWampBinding> authenticationBindings =
                bindings.Select(binding => CreateAuthenticationBinding((dynamic) binding))
                        .Cast<IWampBinding>()
                        .Where(x => x != null);

as authenticationBindings is empty after the call.

Repro:

using System;
using System.Reactive.Concurrency;
using WampSharp.Binding;
using WampSharp.Fleck;
using WampSharp.V2;
using WampSharp.V2.Authentication;
using WampSharp.V2.Binding;
using WampSharp.V2.Client;
using WampSharp.V2.MetaApi;
using WampSharp.V2.Transports;

namespace WampRouter
{
    class Program
    {
        private static WampChannelFactory mChannelFactory;
        private static InMemoryTransport mInMemoryTransport;
        private static InMemoryBinding mInMemoryBinding;

        class AuthFactory : IWampSessionAuthenticatorFactory
        {
            public IWampSessionAuthenticator GetSessionAuthenticator(WampPendingClientDetails details,
                IWampSessionAuthenticator transportAuthenticator)
            {
                throw new NotImplementedException();
            }
        }

        static void Main()
        {
            JTokenJsonBinding jsonBinding = new JTokenJsonBinding();
            JTokenMsgpackBinding msgPackBinding = new JTokenMsgpackBinding();

            var host = new WampAuthenticationHost(new AuthFactory());
            FleckWebSocketTransport websocketTransport = new FleckWebSocketTransport("ws://0.0.0.0:50002/");
            host.RegisterTransport(websocketTransport, jsonBinding, msgPackBinding);

            mInMemoryBinding = new InMemoryBinding();
            mInMemoryBinding.AddFormatter(jsonBinding.Formatter);
            mInMemoryBinding.AddFormatter(msgPackBinding.Formatter);
            mChannelFactory = new WampChannelFactory();
            mInMemoryTransport = new InMemoryTransport(DefaultScheduler.Instance);
            host.RegisterTransport(mInMemoryTransport,
                new IWampBinding[] { mInMemoryBinding });

            host.Open();
            Console.WriteLine("Host running.");

            Console.ReadLine();
        }
    }
}

Thanks
Esso

darkl added a commit that referenced this issue Aug 9, 2018
@darkl
Copy link
Member

darkl commented Aug 9, 2018

Should be fixed in 18.8.1.

@esso23
Copy link
Author

esso23 commented Aug 9, 2018

Tried it just now, everything is working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants