pub fn start(&self) -> Result<Listening> {
        debug!("starting websocket server");
        let websocket_listening =
            websocket::Server::new().listen(("localhost", self.config.websocket_port))?;
        debug!(
            "websockets listening on {}",
            websocket_listening.local_addr()?
        );

        let config = &self.config;

        let initial_html = if let Some(ref initial_markdown) = config.initial_markdown.as_ref() {
            markdown_to_html(initial_markdown, &config.external_renderer)?
        } else {
            String::new()
        };

        debug!("starting http_server");
        let assigned_websocket_port = websocket_listening.local_addr()?.port();
        let http_listening = http::Server::new(
            self.config.working_directory.clone(),
            assigned_websocket_port,
            http::StyleConfig {
                css: config.custom_css.clone(),
                highlight_theme: config.highlight_theme.clone(),
            },
        ).listen(("localhost", config.http_port), &initial_html)?;
        debug!("http listening on {}", http_listening.local_addr()?);

        let listening = Listening {
            http_listening: http_listening,
            websocket_listening: websocket_listening,
            external_renderer: config.external_renderer.clone(),
        };

        Ok(listening)
    }
/// Starts the server.
///
/// Returns a channel that can be used to send markdown to the server. The markdown will be
/// sent as HTML to all clients of the websocket server.
Starts the server.
Returns a channel that can be used to send markdown to the server. The markdown will be
sent as HTML to all clients of the websocket server.
Starts the server . Returns a channel that can be used to send markdown to the server . The markdown will be sent as HTML to all clients of the websocket server .
pub fn start(&self) -> Result<Listening> {
        debug!("starting websocket server");
        let websocket_listening =
            websocket::Server::new().listen(("localhost", self.config.websocket_port))?;
        debug!(
            "websockets listening on {}",
            websocket_listening.local_addr()?
        );
        let config = &self.config;
        let initial_html = if let Some(ref initial_markdown) = config.initial_markdown.as_ref() {
            markdown_to_html(initial_markdown, &config.external_renderer)?
        } else {
            String::new()
        };
        debug!("starting http_server");
        let assigned_websocket_port = websocket_listening.local_addr()?.port();
        let http_listening = http::Server::new(
            self.config.working_directory.clone(),
            assigned_websocket_port,
            http::StyleConfig {
                css: config.custom_css.clone(),
                highlight_theme: config.highlight_theme.clone(),
            },
        ).listen(("localhost", config.http_port), &initial_html)?;
        debug!("http listening on {}", http_listening.local_addr()?);
        let listening = Listening {
            http_listening: http_listening,
            websocket_listening: websocket_listening,
            external_renderer: config.external_renderer.clone(),
        };
        Ok(listening)
    }
pub fn start ( & self ) -> Result < Listening > { debug ! ( " " ) ; let websocket_listening = websocket :: Server :: new ( ) . listen ( ( " " , self . config . websocket_port ) ) ? ; debug ! ( " " websocket_listening local_addr ( ) ) ; let config = & self . config ; let initial_html = if let Some ( ref initial_markdown ) = config . initial_markdown . as_ref ( ) { markdown_to_html ( initial_markdown , & config . external_renderer ) ? } else { String :: new ( ) } ; debug ! ( " " ) ; let assigned_websocket_port = websocket_listening . local_addr ( ) ? . port ( ) ; let http_listening = http :: Server :: new ( self . config . working_directory . clone ( ) , assigned_websocket_port , http :: StyleConfig { css : config . custom_css . clone ( ) , highlight_theme : config . highlight_theme . clone ( ) , } , ) . listen ( ( " " , config . http_port ) , & initial_html ) ? ; debug ! ( " " http_listening local_addr ( ) ) ; let listening = Listening { http_listening : http_listening , websocket_listening : websocket_listening , external_renderer : config . external_renderer . clone ( ) , } ; Ok ( listening ) }
Starts the server.
Starts the server .
&self
&self