Compare commits
2
Commits
7649a4795f
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6eb36d63e | ||
|
|
c99fe43dfc |
@@ -0,0 +1,33 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
const (
|
||||||
|
topicOperation = "op"
|
||||||
|
topicDeployment = "deployment"
|
||||||
|
)
|
||||||
|
|
||||||
|
// QOS is the predefined Quality of Service level for MQTT messages.
|
||||||
|
//
|
||||||
|
//goland:noinspection GoUnusedConst
|
||||||
|
const QOS = 2
|
||||||
|
|
||||||
|
// OperationTopic returns the topic for operation messages for a given client ID.
|
||||||
|
//
|
||||||
|
//goland:noinspection GoUnusedExportedFunction
|
||||||
|
func OperationTopic(clientId string) string {
|
||||||
|
return makeTopic(clientId, topicOperation)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeploymentTopic returns the topic for deployment messages for a given client ID.
|
||||||
|
//
|
||||||
|
//goland:noinspection GoUnusedExportedFunction
|
||||||
|
func DeploymentTopic(clientId string) string {
|
||||||
|
return makeTopic(clientId, topicDeployment)
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeTopic(clientId, topic string) string {
|
||||||
|
if clientId != "" {
|
||||||
|
clientId += "/"
|
||||||
|
}
|
||||||
|
|
||||||
|
return clientId + topic
|
||||||
|
}
|
||||||
Reference in new issue
Block a user