Skip to main content

Module server

Module server 

Source
Available on crate feature server only.
Expand description

The server side of RFC 8887: a per-connection session driver.

Connection::run reads Inbound messages from any Stream and writes Outbound messages to any Sink, so it is independent of the WebSocket library. The deployment does the opening handshake (authentication, RFC 8887 §4.1; the jmap subprotocol, §4.2, see offers_jmap), maps its library’s messages to Inbound / Outbound (feature tungstenite does this for tokio-tungstenite), and calls run once per connection.

Structs§

Connection
One JMAP-over-WebSocket connection: a RequestHandler, a PushSource and limits. See the module docs.
ConnectionConfig
Per-connection limits and policies.
DispatcherHandler
A RequestHandler that dispatches every Request on a Dispatcher for one caller.
NoPush
A PushSource that never pushes, for a server whose capability says supportsPush: false. A WebSocketPushEnable is accepted and yields nothing.
PublishingHandler
A RequestHandler that runs inner, then publishes the state changes of its /set responses (state_change_for_response) to a PushHub, so connections with push enabled hear about writes made over the WebSocket without the deployment wiring it by hand.
PushHub
A fan-out of state changes to every connection of one principal, with RFC 8887 §4.3.5.1 pushState tokens and replay.

Enums§

BinaryFrames
What the driver does with a binary message (RFC 8887 §4.3.1: “the endpoint can either ignore the frame or close the WebSocket connection”).
ConnectionError
Why Connection::run stopped early.
Inbound
A WebSocket message received from the client, as the driver needs it.
Outbound
A WebSocket message the driver sends.

Constants§

CLOSE_UNSUPPORTED_DATA
The WebSocket close status for a binary message (RFC 8887 §4.3.1, RFC 6455 §7.4.1: 1003 Unsupported Data).

Traits§

PushSource
Where a connection’s push notifications come from (RFC 8887 §4.3.5).
RequestHandler
Answers the Requests of one connection.

Functions§

filter_state_change
Cuts change to data_types (RFC 8887 §4.3.5.2: “A StateChange notification will only be sent if the data for one of these types changes. Other types are omitted from the TypeState object.”).
parse_client_message
Reads one text message from the client (RFC 8887 §4.3).
request_error
The RFC 8887 §4.3.4 RequestError for a request-level err: its RFC 8620 §3.6.1 problem details (status from jmap_server::error_status) with requestId set to request_id.
state_change_for_response
The StateChange a Response implies: the newState of every Foo/set response whose state changed (oldState differs, RFC 8620 §5.3), keyed by its accountId and the data type Foo. None when nothing changed.