The HTTP Namespace manager provides the basic web server type features required for the Terrarium application to function when in peer to peer mode and enable easy transmission of peer messages.
Beispiel #1
0
 /// <summary>
 ///  Stop the HTTP Listener used for Peer to Peer interaction.
 /// </summary>
 public void StopHttpNamespaceManager()
 {
     _namespaceManager.Stop();
     _namespaceManager = null;
 }
Beispiel #2
0
        /// <summary>
        ///  Start the HTTP Listener used for Peer to Peer interaction.
        /// </summary>
        public void StartHttpNamespaceManager()
        {
            _namespaceManager = new HttpNamespaceManager();
            _namespaceManager.BeforeProcessRequest += BeforeProcessRequest;
            _namespaceManager.AfterProcessRequest += AfterProcessRequest;

            // Starting the manager starts the http listener
            _namespaceManager.Start(HostIP, PortNumber);

            // Register the namespaces we intend to service
            var versionHandler = new VersionNamespaceHandler();
            var organismsHandler = new OrganismsNamespaceHandler(this);
            _namespaceManager.RegisterNamespace("version", versionHandler);
            _namespaceManager.RegisterNamespace("organisms", organismsHandler);
            _namespaceManager.RegisterNamespace("organisms/", organismsHandler);
        }