Enum TextMessage

Source
pub enum TextMessage {
    Publish {
        name: String,
        pubuid: u32,
        data_type: String,
        properties: Properties,
    },
    Unpublish {
        pubuid: u32,
    },
    SetProperties {
        name: String,
        update: Properties,
    },
    Subscribe {
        topics: Vec<String>,
        subuid: u32,
        options: SubscriptionOptions,
    },
    Unsubscribe {
        subuid: u32,
    },
    Announce {
        name: String,
        id: u32,
        data_type: String,
        pubuid: Option<u32>,
        properties: Properties,
    },
    Unannounce {
        name: String,
        id: u32,
    },
    Properties {
        name: String,
        ack: bool,
        update: Properties,
    },
}

Variants§

§

Publish

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 (TextMessage::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

The topic name being published

§pubuid: u32

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.

§data_type: String

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 TextMessage::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: 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 TextMessage::Announce message contains the actual topic properties. Clients can use the TextMessage::SetProperties message to change properties after topic creation.

§

Unpublish

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 (TextMessage::Unannounce) to all clients who have been sent a previous Topic Announcement Message (TextMessage::Announce) for the topic.

Fields

§pubuid: u32

The same unique identifier passed to the TextMessage::Publish message

§

SetProperties

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 (TextMessage::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.

Fields

§name: String
§update: Properties
§

Subscribe

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 (TextMessage::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>

One or more topic names or prefixes (if the prefix option is true) to start receiving messages for.

§subuid: u32

A client-generated unique identifier for this subscription. Use the same UID later to unsubscribe.

§

Unsubscribe

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

Fields

§subuid: u32

The same unique identifier passed to the TextMessage::Subscribe message

§

Announce

The server shall send this message for each of the following conditions:

  • To all clients subscribed to a matching prefix when a topic is created
  • To a client in response to an Publish Request Message (TextMessage::Publish) from that client

Fields

§name: String
§id: u32

The identifier that the server will use in MessagePack messages for this topic

§data_type: String

The data type for the topic (as a string)

§pubuid: Option<u32>

If this message was sent in response to a TextMessage::Publish message, the Publisher UID provided in that message. Otherwise absent.

§properties: Properties

Topic Properties

§

Unannounce

The server shall send this message when a previously announced (via a Topic Announcement Message (TextMessage::Announce)) topic is deleted.

Fields

§name: String
§id: u32

The identifier that the server was using for value updates

§

Properties

The server shall send this message when a previously announced (via a Topic Announcement Message (TextMessage::Announce)) topic has its properties changed (via Set Properties Message (TextMessage::SetProperties)).

Fields

§name: String
§ack: bool

True if this message is in response to a TextMessage::SetProperties message from the same client. Otherwise absent.

§update: Properties

The client shall handle the update value as follows. 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.

Trait Implementations§

Source§

impl Debug for TextMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TextMessage

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for TextMessage

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,