Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public void StartServer(IEnumerable <string> urlPrefixes, string certificatePath)
 {
     CertificatePath = certificatePath;
     UrlPrefixes     = urlPrefixes.ToList();
     Start(UrlPrefixes.First());
 }
Exemplo n.º 3
0
 public void StartServer(IEnumerable <string> urlPrefixes)
 {
     UrlPrefixes = urlPrefixes.ToList();
     Start(UrlPrefixes.First());
 }
Exemplo n.º 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);
        }
Exemplo n.º 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));
            }
        }
Exemplo n.º 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);
        }