Exemple #1
0
        public RegistrationDescriptorService(IWampRealm realm) :
            base(new RegistrationMetadataSubscriber(realm.TopicContainer), WampErrors.NoSuchRegistration)
        {
            IWampRpcOperationCatalog rpcCatalog = realm.RpcCatalog;

            IObservable <IWampProcedureRegistration> removed =
                GetRegistrationRemoved(rpcCatalog);

            var observable =
                from registration in GetRegistrationAdded(rpcCatalog)
                let registrationRemoved = removed.Where(x => x == registration)
                                          let calleeRegistered = GetCalleeRegistered(registration, registrationRemoved)
                                                                 let calleeUnregistered = GetCalleeUnregistered(registration, registrationRemoved)
                                                                                          select new { registration, calleeRegistered, calleeUnregistered };

            var addObservable =
                from item in observable
                from operation in item.calleeRegistered
                select new { Registration = item.registration, Operation = operation };

            var removeObservable =
                from item in observable
                from operation in item.calleeUnregistered
                select new { Registration = item.registration, Operation = operation };

            IDisposable addDisposable    = addObservable.Subscribe(x => OnRegistrationAdded(x.Registration, x.Operation));
            IDisposable removeDisposable = removeObservable.Subscribe(x => OnRegistrationRemoved(x.Registration, x.Operation));

            mDisposable = new CompositeDisposable(addDisposable, removeDisposable);

            mOperationCatalog = rpcCatalog;
        }
        private IWampHostedRealm BuildRealm(string name)
        {
            IWampRealm      realRealm = mRealmContainer.GetRealmByName(name);
            WampHostedRealm decorated = new WampHostedRealm(realRealm);

            return(decorated);
        }
Exemple #3
0
        private static void RouterCode(string serverAddress, IEnumerable <IWampRpcOperation> operations)
        {
            DefaultWampHost host =
                new DefaultWampHost(serverAddress, new IWampBinding[]
            {
                new JTokenMsgpackBinding(),
                new JTokenJsonBinding(),
            });

            IWampRealm realm = host.RealmContainer.GetRealmByName("realm1");

            foreach (IWampRpcOperation operation in operations)
            {
                realm.RpcCatalog.Register(operation, new RegisterOptions());
            }

            host.Open();
            Console.WriteLine("Server is up");
            Console.ReadLine();
        }
 public WampHostedRealm(IWampRealm underlyingRealm)
 {
     mUnderlyingRealm = underlyingRealm;
 }
 public virtual IWampDealer <TMessage> CreateDealerHandler <TMessage>(IWampRealm realm, IWampBinding <TMessage> binding)
 {
     return(new WampRpcServer <TMessage>(realm.RpcCatalog, binding, mUriValidator));
 }
 public virtual IWampBroker <TMessage> CreateBrokerHandler <TMessage>(IWampRealm realm, IWampBinding <TMessage> binding, IWampEventSerializer eventSerializer)
 {
     return(new WampPubSubServer <TMessage>(realm.TopicContainer, eventSerializer, binding, mUriValidator));
 }