Skip to main content

Crate strand_bui_backend_session

Crate strand_bui_backend_session 

Source
Expand description

Backend session management for the BUI (Browser User Interface) used by Strand Camera and Braid.

This crate provides HTTP session management functionality for web-based user interfaces, including cookie handling, authentication tokens, and request/response processing. It’s designed to work with browser-based frontends that communicate with Rust backend services.

§Features

  • HTTP session management with automatic cookie handling
  • Support for pre-shared authentication tokens
  • Async/await support for all HTTP operations
  • Integration with the Strand Camera and Braid ecosystems

§Examples

use strand_bui_backend_session::{HttpSession, create_session};
use std::sync::{Arc, RwLock};

// Create a cookie store for session management
let jar = Arc::new(RwLock::new(cookie_store::CookieStore::new(None)));

// Server information with authentication token
let server_info = strand_bui_backend_session_types::BuiServerAddrInfo::new(
    "127.0.0.1:8080".parse()?,
    strand_bui_backend_session_types::AccessToken::NoToken
);

// Create an authenticated session
let mut session = create_session(&server_info, jar).await?;

// Make requests using the session
let response = session.get("api/status").await?;

Structs§

HttpSession
An HTTP session for communicating with a single server.
SpecifiedSocketAddr
A newtype wrapping a SocketAddr which ensures that it is specified.

Enums§

Error
Errors that can occur during HTTP session operations.

Functions§

build_urls
Builds a list of HTTP URIs for the server address.
create_session
Creates an authenticated HttpSession by making an initial request with the provided token.

Type Aliases§

MyBody
Type alias for the HTTP body type used throughout the crate.