Skip to content

Commit ac431a3

Browse files
committed
Wildcard change
1 parent 945e412 commit ac431a3

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

nmqtt.nim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,12 @@ proc onPublish(ctx: MqttCtx, pkt: Pkt) {.async.} =
836836

837837
when not defined(broker):
838838
for top, cb in ctx.pubCallbacks:
839-
if top == topic or top.endsWith("#"): cb.cb(topic, message)
839+
if top == topic: cb.cb(topic, message)
840+
if top.endsWith("#"):
841+
var topicw = top
842+
topicw.removeSuffix("#")
843+
if topic.contains(topicw):
844+
cb.cb(topic, message)
840845

841846
if qos == 1:
842847
ctx.workQueue[msgId] = Work(wk: PubWork, msgId: msgId, state: WorkNew, qos: 1, typ: PubAck)

0 commit comments

Comments
 (0)