Enum dscfg_proto::Request
source · pub enum Request<Val = Value> {
Set {
key: String,
value: Val,
},
Get {
key: String,
},
Subscribe {
key: String,
notify_now: bool,
},
Unsubscribe {
key: String,
},
}
Expand description
Request sent from client to server.
This enum represents possible requests accepted by the server. See the documentation of its variants to understand possible requests.
This enum is parametric over value type in order to skip conversions
to json::Value
when sending the request.
Variants
Set
Sets the value of key
to value
There’s no response, but if the client is subscribed
with the key
, it will get the notification.
Get
Fields
key: String
Gets the value of the key
Response of type Value
follows this request.
Subscribe
Requests notifications when any of the keys change.
If notify_now
is set to true
, the client is
also notified immediately after the response.
The response is either OperationOk
, if the cliet was
subscribed or Ignored
, if the client was already subscribed.
Unsubscribe
Fields
key: String
Requests the server to stop notifying the client
Note that this isn’t necessary if the client is going to disconnect - the subscribtions of the client are automatically cleared on disconnect.
If the unsubscribe operation was performed, OperationOk
response is sent. If the client wasn’t subscribed,
Ignored
is sent.