Skip to main content

Crate codetics_ocpp_ws

Crate codetics_ocpp_ws 

Source
Expand description

A small, dependency-light WebSocket implementation for OCPP-J.

  • RFC 6455 framing, fragmentation, control frames and close handshake.
  • RFC 7692 permessage-deflate, which OCPP 2.0.1/2.1 make mandatory for a CSMS (Part 4 §3.3), with a memory profile suited to very many idle connections (see deflate).
  • The HTTP upgrade itself is left to the embedding HTTP server (axum/hyper on the CSMS side); client contains a minimal client for tests and simulators.

The connection is split into a cancel-safe WsReader and a WsWriter so that one task per connection can multiplex reads, timers and commands.

Re-exports§

pub use conn::Message;
pub use conn::Role;
pub use conn::WsConfig;
pub use conn::WsError;
pub use conn::WsReader;
pub use conn::WsWriter;
pub use conn::close_code;
pub use deflate::DeflateConfig;
pub use deflate::DeflateParams;

Modules§

base64
Standard Base64 (RFC 4648 §4) with padding.
client
Minimal WebSocket client, used by integration tests and the charging-station simulator. connect opens plain TCP; [handshake] runs over any established stream (e.g. a TLS stream).
conn
Message-level reader and writer halves of a WebSocket connection.
deflate
RFC 7692 permessage-deflate: negotiation and per-message codec.
frame
RFC 6455 §5 base framing.
handshake
Opening handshake helpers (RFC 6455 §4).
sha1
SHA-1 (FIPS 180-4), used only to compute Sec-WebSocket-Accept. SHA-1 is not used for any security property here; RFC 6455 mandates it purely as a handshake checksum.

Functions§

server
Wraps an upgraded server-side stream into reader/writer halves.