Exemple #1
0
        /// <summary>
        /// Starts the Web Service
        /// </summary>
        private void StartListener()
        {
            WebSocketSharpRequest.HandlerFactoryPath = GetHandlerPathIfAny(UrlPrefixes.First());

            _listener = GetListener();

            _listener.WebSocketConnected  = OnWebSocketConnected;
            _listener.WebSocketConnecting = OnWebSocketConnecting;
            _listener.ErrorHandler        = ErrorHandler;
            _listener.RequestHandler      = RequestHandler;

            _listener.Start(UrlPrefixes);
        }
 public void StartServer(IEnumerable <string> urlPrefixes, string certificatePath)
 {
     CertificatePath = certificatePath;
     UrlPrefixes     = urlPrefixes.ToList();
     Start(UrlPrefixes.First());
 }
Exemple #3
0
 public void StartServer(IEnumerable <string> urlPrefixes)
 {
     UrlPrefixes = urlPrefixes.ToList();
     Start(UrlPrefixes.First());
 }
Exemple #4
0
        /// <summary>
        /// Starts the Web Service
        /// </summary>
        private void StartListener()
        {
            HostContext.Config.HandlerFactoryPath = ListenerRequest.GetHandlerPathIfAny(UrlPrefixes.First());

            _listener       = NativeWebSocket.IsSupported
                ? _listener = new HttpListenerServer(_logger, OnRequestReceived)
                              //? _listener = new WebSocketSharpListener(_logger, OnRequestReceived)
                : _listener = new WebSocketSharpListener(_logger, OnRequestReceived);

            _listener.WebSocketHandler = WebSocketHandler;
            _listener.ErrorHandler     = ErrorHandler;
            _listener.RequestHandler   = RequestHandler;

            _listener.Start(UrlPrefixes);
        }
Exemple #5
0
        /// <summary>
        /// Starts the Web Service
        /// </summary>
        private void StartListener()
        {
            // *** Already running - just leave it in place
            if (IsStarted)
            {
                return;
            }

            if (Listener == null)
            {
                Listener = new HttpListener();
            }

            HostContext.Config.HandlerFactoryPath = ListenerRequest.GetHandlerPathIfAny(UrlPrefixes.First());

            foreach (var prefix in UrlPrefixes)
            {
                _logger.Info("Adding HttpListener prefix " + prefix);
                Listener.Prefixes.Add(prefix);
            }

            IsStarted = true;
            _logger.Info("Starting HttpListner");
            Listener.Start();

            for (var i = 0; i < _autoResetEvents.Count; i++)
            {
                var index = i;
                ThreadPool.QueueUserWorkItem(o => Listen(o, index));
            }
        }
Exemple #6
0
        /// <summary>
        /// Starts the Web Service
        /// </summary>
        private void StartListener()
        {
            HostContext.Config.HandlerFactoryPath = ListenerRequest.GetHandlerPathIfAny(UrlPrefixes.First());

            _listener = GetListener();

            _listener.WebSocketHandler = WebSocketHandler;
            _listener.ErrorHandler     = ErrorHandler;
            _listener.RequestHandler   = RequestHandler;

            _listener.Start(UrlPrefixes);
        }