27 releases (5 breaking)

0.6.1 Oct 11, 2024
0.5.5 Sep 16, 2024
0.2.0 Jul 31, 2024

#693 in Web programming

Download history 805/week @ 2024-07-29 1204/week @ 2024-08-05 410/week @ 2024-08-12 141/week @ 2024-08-19 247/week @ 2024-08-26 200/week @ 2024-09-02 76/week @ 2024-09-09 504/week @ 2024-09-16 187/week @ 2024-09-23 103/week @ 2024-09-30 275/week @ 2024-10-07 39/week @ 2024-10-14 83/week @ 2024-10-21 166/week @ 2024-10-28 125/week @ 2024-11-04 62/week @ 2024-11-11

437 downloads per month
Used in 3 crates

Apache-2.0

31KB
498 lines

protosocket-connection

protosocket-connection provides a flexible, asynchronous TCP connection handler. It's designed to efficiently manage bidirectional, message-oriented TCP streams with customizable serialization and deserialization.

Key Features

  • Low abstraction - no http or higher level constructs
  • Asynchronous I/O using mio via tokio
  • Customizable message types through ConnectionBindings
  • Efficient buffer management and flexible error handling

Flow Diagrams

The poll() function on connection.rs controls the lifecycle of the entire connection. You're recommended to read individual comments on the code to understand the flow, but below is a sequence diagram to get you started:

sequenceDiagram
    participant P as Poll
    participant IS as Inbound Socket
    participant D as Deserializer
    participant R as Reactor
    participant S as Serializer
    participant OS as Outbound Socket

    P->>IS: Read from inbound socket
    IS->>D: Raw data
    D->>P: Deserialize inbound messages
    P->>R: Submit inbound messages
    R-->>P: Process messages
    P->>S: Prepare and serialize outbound messages
    S->>P: Serialized outbound bytes
    P->>OS: Write to outbound socket

Dependencies

~4–13MB
~133K SLoC