Пример #1
0
        public void AddService <T>(string absPath)
            where T : WebSocketService, new()
        {
            string msg;

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

            var svcHost = new WebSocketServiceHost <T>();

            svcHost.Uri = Ext.ToUri(absPath);
            if (!Sweeped)
            {
                svcHost.Sweeped = Sweeped;
            }

            _services.Add(absPath, svcHost);
        }
Пример #2
0
        /// <summary>
        /// Adds a WebSocket service.
        /// </summary>
        /// <param name="absPath">
        /// A <see cref="string"/> that contains an absolute path associated with a WebSocket service.
        /// </param>
        /// <typeparam name="T">
        /// The type of a WebSocket service. The T must inherit the <see cref="WebSocketService"/> class.
        /// </typeparam>
        public void AddService <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;
            }

            _services.Add(absPath, svcHost);
        }