feagi_io/protocol_implementations/websocket/websocket_std/mod.rs
1//! WebSocket transport implementations.
2//!
3//! This module provides WebSocket-based implementations of the FEAGI networking traits
4//! using the `tungstenite` crate with non-blocking sockets. All operations use
5//! `set_nonblocking(true)` and check for `WouldBlock`, making them compatible
6//! with any async runtime or synchronous usage.
7//!
8//! # Socket Patterns
9//!
10//! | Server | Client | Pattern |
11//! |--------|--------|---------|
12//! | [`FeagiWebSocketServerPublisher`] | [`FeagiWebSocketClientSubscriber`] | Pub/Sub (broadcast) |
13//! | [`FeagiWebSocketServerPuller`] | [`FeagiWebSocketClientPusher`] | Push/Pull (pipeline) |
14//! | [`FeagiWebSocketServerRouter`] | [`FeagiWebSocketClientRequester`] | Router/Dealer (req/rep) |
15//!
16//! # Creating Instances
17//!
18//! All server and client instances are created through their Properties types:
19//!
20//! ```ignore
21//! // Server example
22//! let props = FeagiWebSocketServerPublisherProperties::new("127.0.0.1:8080")?;
23//! let mut server = props.as_boxed_server_publisher();
24//!
25//! // Client example
26//! let props = FeagiWebSocketClientSubscriberProperties::new("ws://localhost:8080")?;
27//! let mut client = props.as_boxed_client_subscriber();
28//! ```
29//!
30#[cfg(feature = "feagi-server")]
31mod server_implementations;
32
33#[cfg(feature = "feagi-client")]
34mod client_implementations;
35
36#[cfg(feature = "feagi-server")]
37// Server implementations and properties
38pub use server_implementations::{
39 FeagiWebSocketServerPublisher, FeagiWebSocketServerPublisherProperties,
40 FeagiWebSocketServerPuller, FeagiWebSocketServerPullerProperties, FeagiWebSocketServerRouter,
41 FeagiWebSocketServerRouterProperties,
42};
43
44#[cfg(feature = "feagi-client")]
45// Client implementations and properties
46pub use client_implementations::{
47 FeagiWebSocketClientPusher, FeagiWebSocketClientPusherProperties,
48 FeagiWebSocketClientRequester, FeagiWebSocketClientRequesterProperties,
49 FeagiWebSocketClientSubscriber, FeagiWebSocketClientSubscriberProperties,
50};