Enum minint::messages::ClientMsg

source ·
pub enum ClientMsg {
    Publish {
        name: String,
        pubuid: i32,
        type: String,
        properties: Option<PublishProps>,
    },
    Unpublish {
        pubuid: i32,
    },
    SetProperties {
        name: String,
        update: BTreeMap<String, String>,
    },
    Subscribe {
        topics: Vec<String>,
        subuid: i32,
        options: BTreeMap<String, String>,
    },
    Unsubscribe {
        subuid: i32,
    },
}

Variants§

§

Publish

Publish Request Message

Sent from a client to the server to indicate the client wants to start publishing values at the given topic. The server shall respond with a Topic Announcement Message ([Announce]), even if the topic was previously announced. The client can start publishing data values via MessagePack messages immediately after sending this message, but the messages will be ignored by the server if the publisher data type does not match the topic data type.

Fields

§name: String

Publish name

The topic name being published

§pubuid: i32

Publisher UID

A client-generated unique identifier for this publisher. Use the same UID later to unpublish. This is also the identifier that the client will use in MessagePack messages for this topic.

§type: String

Type of data

The requested data type (as a string).

If the topic is newly created (e.g. there are no other publishers) this sets the value type. If the topic was previously published, this is ignored. The [Announce] message contains the actual topic value type that the client shall use when publishing values.

Implementations should indicate an error if the user tries to publish an incompatible type to that already set for the topic.

§properties: Option<PublishProps>

Properties

Initial topic properties.

If the topic is newly created (e.g. there are no other publishers) this sets the topic properties. If the topic was previously published, this is ignored. The [Announce] message contains the actual topic properties. Clients can use the [SetProperties] message to change properties after topic creation.

§

Unpublish

Publish Release Message

Sent from a client to the server to indicate the client wants to stop publishing values for the given topic and publisher. The client should stop publishing data value updates via binary MessagePack messages for this publisher prior to sending this message.

When there are no remaining publishers for a non-persistent topic, the server shall delete the topic and send a Topic Removed Message ([Unannounce]) to all clients who have been sent a previous Topic Announcement Message ([Announce]) for the topic.

Fields

§pubuid: i32

Publisher UID

The same unique identifier passed to the [Publish] message

§

SetProperties

Set Properties Message

Sent from a client to the server to change properties (see Properties) for a given topic. The server will send a corresponding Properties Update Message ([Properties]) to all subscribers to the topic (if the topic is published). This message shall be ignored by the server if the topic is not published.

If a property is not included in the update map, its value is not changed. If a property is provided in the update map with a value of null, the property is deleted.

Fields

§name: String

Topic name

§update: BTreeMap<String, String>

Properties to update

§

Subscribe

Subscribe Message

Sent from a client to the server to indicate the client wants to subscribe to value changes for the specified topics / groups of topics. The server shall send MessagePack messages containing the current values for any existing cached topics upon receipt, and continue sending MessagePack messages for future value changes. If a topic does not yet exist, no message is sent until it is created (via a publish), at which point a Topic Announcement Message ([Announce]) will be sent and MessagePack messages will automatically follow as they are published.

Subscriptions may overlap; only one MessagePack message is sent per value change regardless of the number of subscriptions. Sending a subscribe message with the same subscription UID as a previous subscribe message results in updating the subscription (replacing the array of identifiers and updating any specified options).

Fields

§topics: Vec<String>
§subuid: i32
§

Unsubscribe

Unsubscribe Message

Sent from a client to the server to indicate the client wants to stop subscribing to messages for the given subscription.

Fields

§subuid: i32

Subscription UID

The same unique identifier passed to the [Subscribe] message

Trait Implementations§

source§

impl Serialize for ClientMsg

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V