Skip to main content

Crate oxigdal_websocket

Crate oxigdal_websocket 

Source
Expand description

OxiGDAL WebSocket - Advanced Real-Time Communication

This crate provides comprehensive WebSocket support for the OxiGDAL geospatial library, enabling real-time data streaming, broadcasting, and live updates.

§Features

  • WebSocket Server: Full-featured server with connection management, heartbeat, and pooling
  • Protocol Support: Binary and JSON protocols with compression and framing
  • Broadcasting: Pub/sub channels, room management, and message filtering
  • Live Updates: Tile updates, feature changes, and change streams
  • Client SDK: JavaScript/TypeScript client with reconnection and caching

§Examples

§Starting a WebSocket Server

use oxigdal_websocket::server::Server;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let server = Server::builder()
        .max_connections(10_000)
        .build();

    server.start().await?;
    Ok(())
}

§Broadcasting Messages

use oxigdal_websocket::broadcast::BroadcastSystem;
use oxigdal_websocket::protocol::message::Message;

let system = BroadcastSystem::new(Default::default());

// Publish to a topic
let message = Message::ping();
system.publish("geospatial-updates", message).await?;

Re-exports§

pub use broadcast::BroadcastConfig;
pub use broadcast::BroadcastSystem;
pub use client_sdk::ClientSdkConfig;
pub use client_sdk::generate_javascript_client;
pub use client_sdk::generate_typescript_definitions;
pub use error::Error;
pub use error::Result;
pub use protocol::Message;
pub use protocol::MessageFormat;
pub use protocol::MessageType;
pub use protocol::Payload;
pub use protocol::ProtocolCodec;
pub use protocol::ProtocolConfig;
pub use server::Server;
pub use server::ServerConfig;
pub use updates::ChangeStream;
pub use updates::FeatureUpdateManager;
pub use updates::IncrementalUpdateManager;
pub use updates::TileUpdateManager;
pub use updates::UpdateConfig;
pub use updates::UpdateSystem;

Modules§

broadcast
Broadcasting and pub/sub system
client_sdk
Client SDK for WebSocket connections
error
Error types for oxigdal-websocket
prelude
Prelude module for convenient imports
protocol
WebSocket protocol implementation
server
WebSocket server implementation
updates
Live updates system for real-time data changes