24 releases (4 breaking)

0.5.4 Aug 11, 2024
0.5.3 Aug 7, 2024
0.4.6 Aug 5, 2024
0.3.1 Aug 3, 2024
0.1.5 Jul 30, 2024

#405 in Web programming

Download history 460/week @ 2024-07-26 1428/week @ 2024-08-02 464/week @ 2024-08-09 178/week @ 2024-08-16 215/week @ 2024-08-23 171/week @ 2024-08-30

1,192 downloads per month
Used in 3 crates

Apache-2.0

30KB
473 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–12MB
~132K SLoC