Check if it is enabled and start the frontend http & websocket
163999
def _start_frontend(self, restart=False):
        """"""

        self.log(self.config, self.config.frontendenabled, lvl=verbose)
        if self.config.frontendenabled and not self.frontendrunning or restart:
            self.log("Restarting webfrontend services on",
                     self.frontendtarget)

            self.static = Static("/",
                                 docroot=self.frontendtarget).register(
                self)
            self.websocket = WebSocketsDispatcher("/websocket").register(self)
            self.frontendrunning = True
1162800
private function turn_on() {
            $this->_logger->entrance();

            if ( $this->is_on() || ! isset( $this->_storage->connectivity_test['is_active'] ) ) {
                return false;
            }

            $updated_connectivity              = $this->_storage->connectivity_test;
            $updated_connectivity['is_active'] = true;
            $updated_connectivity['timestamp'] = WP_FS__SCRIPT_START_TIME;
            $this->_storage->connectivity_test = $updated_connectivity;

            $this->_is_on = true;

            return true;
        }
254599
def on_open(self, ws):
        
        self.callback.on_connected()

        # Send initialization message
        init_data = self.build_start_message(self.options)
        self.ws_client.send(json.dumps(init_data).encode('utf8'), websocket.ABNF.OPCODE_TEXT)
891262
async function start () {
    var config = this.immutableApp
    var module = this
    // initialize app if not yet initialized
    if (!config.initialized) {
        try {
            await this.init()
        }
        catch (err) {
            throw err
        }
    }
    // run any start functions for modules
    await Promise.each(_.values(config.modules), subModule => {
        // if onStart is function run it
        if (typeof subModule.onStart === 'function') {
            return subModule.onStart(config)
        }
    })
    debug('start Promise')
    // create new promise that will be resolved when server started
    return new Promise(function (resolve, reject) {
        // create HTTP server
        config.server = http.createServer(config.express)
        // create error handler
        config.server.on('error', function (err) {
            // only deal with listen errors
            if (err.syscall !== 'listen') {
                throw err
            }
            // log error if logging enable
            if (config.log) {
                // error msg detail
                var msg
                // get specific errors
                if (err.code === 'EACCES') {
                    msg = 'permission denied'
                }
                else if (err.code === 'EADDRINUSE') {
                    msg = 'address in use'
                }
                else {
                    msg = err.code
                }
                // log error
                console.error('listen on port '+config.port+' failed '+msg)
            }
            // if exit on error is set then exit
            if (config.exit) {
                process.exit(1)
            }
            // reject promise with error
            reject(err)
        })
        debug('start listen')
        // listen on provided port, on all network interfaces.
        config.server.listen(config.port, function () {
            // log start if logging enabled
            if (config.log) {
                console.log(module.name+' listening on port '+config.port)
            }
            // set started to true
            config.started = true
            // resolve promise
            resolve()
        })
    })
    // after starting check the START_TEST_ONLY flag and shut back down if it
    // is set - this flag is used to validate app config and sync models
    .then(() => {
        if (process.env.START_TEST_ONLY) {
            return this.stop().then(() => {
                if (config.log) {
                    console.log('START_TEST_ONLY success - server stopped')
                }
                process.exit()
            })
        }
    })
}
1352081
def start(self):
        
        self.started = True
        if self.app:
            web_port = self.config['network']['web_port']
            logger.info('Starting server listening on port {0}'.format(web_port))
            key_file = os.path.join(self.work_dir, 'server.key')
            cert_file = os.path.join(self.work_dir, 'server.crt')
            http_server = WSGIServer(('', web_port), self.app, keyfile=key_file, certfile=cert_file)
            http_server_greenlet = gevent.spawn(http_server.serve_forever)
            self.greenlets.append(http_server_greenlet)

        stop_if_not_write_workdir(self.work_dir)
        logger.info('Server started.')
        gevent.joinall(self.greenlets)
1245141
public function checkUsingSocket(){
		$conn	= @fsockopen( 'google.com', 443);
		$this->status = $conn ? self::STATUS_ONLINE : self::STATUS_OFFLINE;
        fclose( $conn );
	}
101159
def setup_backend(
    serve=True,
    host=DEFAULT_HOST,
    port=DEFAULT_PORT,
    debug=False,
    open_browser=True,
    browsername=None,
    testing=False,
    private_key=None,
    certificate=None,
    LLDB=False,
):
    """"""
    app.config["LLDB"] = LLDB

    kwargs = {}
    ssl_context = get_ssl_context(private_key, certificate)
    if ssl_context:
        # got valid ssl context
        # force everything through https
        SSLify(app)
        # pass ssl_context to flask
        kwargs["ssl_context"] = ssl_context

    url = "%s:%s" % (host, port)
    if kwargs.get("ssl_context"):
        protocol = "https://"
        url_with_prefix = "https://" + url
    else:
        protocol = "http://"
        url_with_prefix = "http://" + url

    if debug:
        async_mode = "eventlet"
    else:
        async_mode = "gevent"

    socketio.server_options["async_mode"] = async_mode
    try:
        socketio.init_app(app)
    except Exception:
        print(
            'failed to initialize socketio app with async mode "%s". Continuing with async mode "threading".'
            % async_mode
        )
        socketio.server_options["async_mode"] = "threading"
        socketio.init_app(app)

    if testing is False:
        if host == DEFAULT_HOST:
            url = (DEFAULT_HOST, port)
        else:
            try:
                url = (socket.gethostbyname(socket.gethostname()), port)
            except Exception:
                url = (host, port)

        if open_browser is True and debug is False:
            browsertext = repr(browsername) if browsername else "default browser"
            args = (browsertext,) + url
            text = ("Opening gdbgui with %s at " + protocol + "%s:%d") % args
            print(colorize(text))
            b = webbrowser.get(browsername) if browsername else webbrowser
            b.open(url_with_prefix)
        else:
            print(colorize("View gdbgui at %s%s:%d" % (protocol, url[0], url[1])))

        print("exit gdbgui by pressing CTRL+C")

        try:
            socketio.run(
                app,
                debug=debug,
                port=int(port),
                host=host,
                extra_files=get_extra_files(),
                **kwargs
            )
        except KeyboardInterrupt:
            # Process was interrupted by ctrl+c on keyboard, show message
            pass
141607
function listen() {
	let httpServer = require('http').createServer(router);
	httpServer.listen(port);
	Coralian.logger.log("Server started");
}
90530
def start():
    '''
    
    '''
    from wsgiref.simple_server import make_server

    # When started outside of salt-api __opts__ will not be injected
    if '__opts__' not in globals():
        globals()['__opts__'] = get_opts()

        if __virtual__() is False:
            raise SystemExit(1)

    mod_opts = __opts__.get(__virtualname__, {})

    # pylint: disable=C0103
    httpd = make_server('localhost', mod_opts['port'], application)

    try:
        httpd.serve_forever()
    except KeyboardInterrupt:
        raise SystemExit(0)
1190944
function startBrowserSync(serverRoot) {

    helper.log('Starting BrowserSync on port ' + 8080 + ' for ' + serverRoot);

    var options = {
        //proxy: 'localhost:' + port,
        port: 8080,
        ws: true,
        server: {
            baseDir: serverRoot
        },
        reloadDelay: config.browserReloadDelay
    };

    browserSync.init(options);

}
1067698
def start(self):
        
        logging.info("HTTP server: "
                     "Starting to listen for requests on '%s:%s'..." %
                     (self.conf['addr'], self.conf['port']))

        self.my_server = MyWSGIRefServer(host=self.conf['addr'],
                                         port=self.conf['port'],
                                         romana_http=self)

        self.http_thread = threading.Thread(
                    target = APP.run,
                    name   = "HTTP",
                    kwargs = {"quiet" : True, "server" : self.my_server})

        self.http_thread.daemon = True
        self.http_thread.start()
        time.sleep(1)
        if not self.wsgi_server_started:
            # Set the global flag indicating that everything should stop
            CURRENT_STATE._stop_all = True
810238
def wait_and_start_browser(host, port=None, cancel_event=None):
    
    if host == '0.0.0.0':
        host = 'localhost'
    if port is None:
        port = 80

    if wait_for_server(host, port, cancel_event):
        start_browser('http://{0}:{1}/'.format(host, port))
1047688
public static function startup()
    {
        global $PPHP;

        trigger('language', self::$_req['lang']);

        if (isset(self::$_PATH[1]) && listeners('route/' . self::$_PATH[0] . '+' . self::$_PATH[1])) {
            self::$_base = array_shift(self::$_PATH) . '+' . array_shift(self::$_PATH);
        } elseif (isset(self::$_PATH[0])) {
            if (listeners('route/' . self::$_PATH[0])) {
                self::$_base = array_shift(self::$_PATH);
            } else {
                trigger('http_status', 404);
            };
        } elseif (listeners('route/main')) {
            self::$_base = 'main';
        } else {
            trigger('http_status', 404);
        };
        self::$_req['path_args'] = self::$_PATH;
    }
667097
async function start() {
  const mainRoute = server.addReactRoute(
    "",
    path.resolve(process.cwd(), "app/Routes.js")
  );

  await server.start(); //start server
  console.log("started");
}
1327399
def enable_service(conn, service='ceph'):
    
    if is_systemd(conn):
        remoto.process.run(
            conn,
            [
                'systemctl',
                'enable',
                '{service}'.format(service=service),
            ]
        )
    else:
        remoto.process.run(
            conn,
            [
                'chkconfig',
                '{service}'.format(service=service),
                'on',
            ]
        )
157236
def enable_websocket(self, enable=True):
        
        if not self.websocket_enabled:
            # if the server is stopped, we want to cancel any ongoing
            # websocket tasks, to allow the server to exit promptly
            @self.listener("before_server_stop")
            def cancel_websocket_tasks(app, loop):
                for task in self.websocket_tasks:
                    task.cancel()

        self.websocket_enabled = enable
461721
def notify_server_ready(self, language, config):
        """"""
        for index in range(self.get_stack_count()):
            editor = self.tabs.widget(index)
            if editor.language.lower() == language:
                editor.start_lsp_services(config)