[dependencies]
dream-net = "1"
The crate is dream_net. Its modules are public, and the types a host uses are also re-exported
from the root, so dream_net::Server and dream_net::server::Server are the same type.
| Page | Covers | Module |
|---|---|---|
| Schema | Schema, SchemaBuilder, ChannelConfig, ChannelDef, EventDef, Delivery, OverflowPolicy, Fingerprint, the schema limits | schema |
| Ids and sequences | EventTypeId, ChannelId, PeerId, Seq16 | id, sequence |
| Server | Server, ServerConfig, ServerEvent | server |
| Client | Client, ClientConfig, ClientEvent, ClientStatus | client |
| Keys and tokens | generate_key, generate_connect_token, Key, UserData and their sizes, from netcode | root |
| TransportConfig | Every limit and timer, its default and its rule, and the datagram constants | config |
| Lifecycle and errors | DisconnectReason, Failure, ConnectionState, ConfigError, SendError, BufferTooSmall, Error | lifecycle, error |
| Statistics | ConnectionStats, Counters, MemoryUsage | stats |
| Connection and inbox | Connection, Shared, ConnectionEvent, Inbox, Record, MessageInfo | connection, inbox |
| Captures | CaptureSink, CaptureWriter, CaptureReader, their records and header | capture |
| Simulator | Pair, Link, LinkConfig, LinkCounters, Rng | sim |
| Wire | Layout, PacketWriter, decode, Decoded, Malformed, and the rest of the codec | wire |
The root#
Re-exported from their modules:
Client, ClientConfig, ClientEvent, ClientStatus client
TransportConfig config
Connection, ConnectionEvent, Shared connection
BufferTooSmall, ConfigError, Error, SendError error
ChannelId, EventTypeId, PeerId id
Inbox, MessageInfo, Record inbox
ConnectionState, DisconnectReason, Failure lifecycle
ChannelConfig, ChannelDef, Delivery, EventDef,
Fingerprint, OverflowPolicy, Schema, SchemaBuilder schema
Seq16 sequence
Server, ServerConfig, ServerEvent server
ConnectionStats, Counters, MemoryUsage stats
And from netcode, so a backend can mint keys and tokens with dream-net alone:
CONNECT_TOKEN_BYTES, KEY_BYTES, Key, USER_DATA_BYTES, UserData,
generate_connect_token and generate_key. See Keys and tokens.
The capture, sim and wire modules, and the constants in schema, config and connection,
are reached through their modules.
Conventions#
- Time is
f64seconds on the host’s monotonic clock. Everyupdate(time)ignores a time earlier than the last. - Payloads are
&[u8]going in and are copied before the call returns. Coming out, they are borrowed until the next poll, or copied into a buffer the caller owns. - Errors: misuse returns an
Err, network conditions are not errors, and malformed remote input is counted and ends the connection. No remote input panics. - Nothing calls back into the host from
update,pollorflush, except the closures aConnectionis given to transmit with and a capture sink the host installed.