예제 #1
0
        /// <summary>
        /// Adds the specified typed WebSocket service.
        /// </summary>
        /// <param name="servicePath">
        /// A <see cref="string"/> that contains an absolute path to the WebSocket service.
        /// </param>
        /// <typeparam name="T">
        /// The type of the WebSocket service. The T must inherit the <see cref="WebSocketService"/> class.
        /// </typeparam>
        public void AddWebSocketService <T> (string servicePath)
            where T : WebSocketService, new ()
        {
            string msg;

            if (!servicePath.IsValidAbsolutePath(out msg))
            {
                Log.Error(msg);
                Error(msg);

                return;
            }

            var host = new WebSocketServiceHost <T> (Log);

            host.Uri = BaseUri.IsAbsoluteUri
               ? new Uri(BaseUri, servicePath)
               : servicePath.ToUri();

            if (!KeepClean)
            {
                host.KeepClean = false;
            }

            _serviceHosts.Add(servicePath, host);
        }
예제 #2
0
        /// <summary>
        /// Adds the specified type WebSocket service.
        /// </summary>
        /// <param name="absPath">
        /// A <see cref="string"/> that contains an absolute path associated with the WebSocket service.
        /// </param>
        /// <typeparam name="T">
        /// The type of the WebSocket service. The T must inherit the <see cref="WebSocketService"/> class.
        /// </typeparam>
        public void AddWebSocketService <T>(string absPath)
            where T : WebSocketService, new()
        {
            string msg;

            if (!absPath.IsValidAbsolutePath(out msg))
            {
                onError(msg);
                return;
            }

            var svcHost = new WebSocketServiceHost <T>();

            svcHost.Uri = absPath.ToUri();
            if (!Sweeping)
            {
                svcHost.Sweeping = false;
            }

            _svcHosts.Add(absPath, svcHost);
        }
예제 #3
0
        /// <summary>
        /// Adds the specified type WebSocket service.
        /// </summary>
        /// <param name="absPath">
        /// A <see cref="string"/> that contains an absolute path associated with the WebSocket service.
        /// </param>
        /// <typeparam name="T">
        /// The type of the WebSocket service. The T must inherit the <see cref="WebSocketService"/> class.
        /// </typeparam>
        public void AddWebSocketService <T>(string absPath)
            where T : WebSocketService, new()
        {
            string msg;

            if (!absPath.IsValidAbsolutePath(out msg))
            {
                Error(msg);
                return;
            }

            var svcHost = new WebSocketServiceHost <T>();

            svcHost.Uri = BaseUri.IsAbsoluteUri
                  ? new Uri(BaseUri, absPath)
                  : absPath.ToUri();
            if (!Sweeped)
            {
                svcHost.Sweeped = Sweeped;
            }

            _svcHosts.Add(absPath, svcHost);
        }
예제 #4
0
        /// <summary>
        /// Adds the specified typed WebSocket service.
        /// </summary>
        /// <param name="absPath">
        /// A <see cref="string"/> that contains an absolute path associated with the WebSocket service.
        /// </param>
        /// <typeparam name="T">
        /// The type of the WebSocket service. The T must inherit the <see cref="WebSocketService"/> class.
        /// </typeparam>
        public void AddWebSocketService <T> (string absPath)
            where T : WebSocketService, new ()
        {
            string msg;

            if (!absPath.IsValidAbsolutePath(out msg))
            {
                _logger.Error(msg);
                error(msg);

                return;
            }

            var svcHost = new WebSocketServiceHost <T> (_logger);

            svcHost.Uri = absPath.ToUri();
            if (!KeepClean)
            {
                svcHost.KeepClean = false;
            }

            _svcHosts.Add(absPath, svcHost);
        }