Skip to content

Conversation

@guyernest
Copy link
Collaborator

Summary

This PR adds comprehensive documentation for transports and middleware in the pmcp-book:

Chapter 10: Transports

  • ch10-transports.md: Complete overview of transport abstraction (32 → 917 lines)

    • "Write once, run anywhere" philosophy
    • Understanding Streamable HTTP modes (stateless/stateful/SSE)
    • Platform-specific deployment guidance (AWS Lambda, Cloudflare Workers, Docker, K8s, etc.)
    • Mode comparison table and selection guide
  • ch10-01-websocket.md: WebSocket client transport (97 lines)

    • SDK-accurate examples with WebSocketConfig
    • Auto-reconnect, ping intervals, retry strategies
    • Reference to WebSocketServerTransport and example 27
  • ch10-02-http.md: HTTP client transport (70 lines)

    • HttpTransport with url::Url configuration
    • Optional SSE notification connection
    • Clean, compiling examples
  • ch10-03-streamable-http.md: Streamable HTTP transport (121 lines)

    • Server implementation with StreamableHttpServer
    • Client implementation with StreamableHttpTransport
    • Three operational modes (stateless, stateful+JSON, stateful+SSE)
    • Protocol headers and content negotiation
    • References to examples 22, 23, 24

Chapter 11: Middleware

  • ch11-middleware.md: Complete middleware documentation (8 → 826 lines)
    • Basic Middleware trait
    • AdvancedMiddleware with priority ordering
    • MiddlewareContext for data/metrics propagation
    • 7 built-in middleware implementations
    • Custom middleware examples
    • Ordering best practices
    • References to example 15

Testing

  • ✅ All 713 tests passed (make test)
  • ✅ All quality gates passed (make quality-gate)
    • Code formatting check
    • Clippy linting (zero warnings)
    • Examples compilation
    • Build verification
    • Unit tests (414 tests)
    • Doc tests (all examples compile and run)

Verification

All chapters verified for:

  • SDK-accurate type references
  • Compiling examples
  • Correct feature flags
  • Accurate example file references

Related

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

guyernest and others added 2 commits October 7, 2025 21:28
Complete rewrite of Chapter 10 transport chapters with SDK-accurate content:

- ch10-01-websocket.md: WebSocket client + optional server transport with
  correct examples using WebSocketTransport, WebSocketConfig, and
  WebSocketServerTransport. Documented feature flag and optional server
  capabilities.

- ch10-02-http.md: HTTP client transport fundamentals with correct examples
  using HttpTransport and HttpConfig. Clarified SSE support and directed
  readers to Streamable HTTP for server deployments.

- ch10-03-streamable-http.md: Streamable HTTP server (Axum-based) and client
  with accurate examples using StreamableHttpServer, StreamableHttpServerConfig,
  StreamableHttpTransport. Documented stateless vs stateful modes, protocol
  headers, and Accept negotiation.

- ch10-transports.md: Updated WebSocket section to reflect client + optional
  server support, corrected feature flags, and added deployment guidance.

All examples verified with: cargo check --examples --features "streamable-http websocket"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Complete Chapter 11 middleware documentation covering:

- Basic Middleware trait for simple request/response interception
- Advanced AdvancedMiddleware with priority ordering, context propagation,
  conditional execution, and lifecycle hooks
- MiddlewareContext for sharing data and metrics across middleware layers
- MiddlewarePriority for controlling execution order (Critical, High, Normal,
  Low, Lowest)
- Built-in middleware implementations:
  * LoggingMiddleware - configurable logging levels
  * AuthMiddleware - authentication support
  * RetryMiddleware - retry logic with exponential backoff
  * RateLimitMiddleware - token bucket rate limiting
  * CircuitBreakerMiddleware - fault tolerance with state management
  * MetricsMiddleware - performance and usage metrics
  * CompressionMiddleware - large message compression
- Custom middleware examples (basic and advanced)
- Middleware ordering best practices and principles
- Performance considerations and optimization techniques
- Examples reference: examples/15_middleware.rs, examples/30_enhanced_middleware.rs,
  and inline doctests in src/shared/middleware.rs

All code examples verified against SDK implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@guyernest guyernest merged commit 393c1d2 into paiml:main Oct 9, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant