Example #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;
        }
Example #2
0
 private static IObservable <IWampProcedureRegistration> GetRegistrationAdded(IWampRpcOperationCatalog rpcCatalog)
 {
     return(Observable.FromEventPattern <WampProcedureRegisterEventArgs>
                (x => rpcCatalog.RegistrationAdded += x,
                x => rpcCatalog.RegistrationAdded -= x)
            .Select(x => x.EventArgs.Registration)
            .Where(x => !WampRestrictedUris.IsRestrictedUri(x.Procedure)));
 }
Example #3
0
        public WampRpcServer(IWampRpcOperationCatalog catalog, IWampBinding <TMessage> binding, IWampUriValidator uriValidator)
        {
            mInvoker      = catalog;
            mUriValidator = uriValidator;
            mLogger       = LogProvider.GetLogger(this.GetType());
            mFormatter    = binding.Formatter;

            mHandler = new WampCalleeInvocationHandler <TMessage>(binding.Formatter);

            mCalleeCatalog = new WampCalleeOperationCatalog <TMessage>
                                 (catalog, mHandler);
        }
Example #4
0
 public WampRealm(string name, IWampRpcOperationCatalog catalog, IWampTopicContainer topicContainer)
 {
     Name           = name;
     RpcCatalog     = catalog;
     TopicContainer = topicContainer;
 }
 public WampCalleeOperationCatalog(IWampRpcOperationCatalog catalog, IWampCalleeInvocationHandler <TMessage> invocationHandler)
 {
     mCatalog           = catalog;
     mInvocationHandler = invocationHandler;
 }
Example #6
0
 public ForwardingRpcCatalog(IWampRpcOperationCatalog rpcCatalog, IWampChannel channel)
 {
     this._rpcCatalog = rpcCatalog;
     this._channel    = channel;
 }