Mosquitto\Message

class Mosquitto\Message

Represents a message received from a broker. All data is represented as properties.

property $topic

(string) The topic this message was delivered to.

property $payload

(string) The payload of this message.

property $mid

(int) The ID of this message.

property $qos

(int) The QoS value applied to this message.

property $retain

(boolean) Whether this is a retained message or not.

This class has two static methods.

static topicMatchesSub

Returns true if the supplied topic matches the supplied description, and otherwise false.

Parameters:
  • $topic (string) – The topic to match
  • $subscription (string) – The subscription to match
static tokeniseTopic

Tokenise a topic or subscription string into an array of strings representing the topic hierarchy.

Parameters:
  • $topic (string) – The topic to tokenise