Hook up new pubsub

This commit is contained in:
Alex Hultman
2019-10-07 10:57:04 +02:00
parent a35d7f2ff3
commit d09f25850b
6 changed files with 39 additions and 8 deletions
+3 -5
View File
@@ -128,7 +128,7 @@ public:
}
/* Make sure to unsubscribe from any pub/sub node at exit */
webSocketContextData->topicTree.unsubscribeAll(this);
webSocketContextData->topicTree.unsubscribeAll((Subscriber *) this);
}
/* Subscribe to a topic according to MQTT rules and syntax */
@@ -138,9 +138,7 @@ public:
);
/* Fix this up */
bool *valid = new bool;
*valid = true;
webSocketContextData->topicTree.subscribe(std::string(topic), this, valid);
webSocketContextData->topicTree.subscribe(topic, (Subscriber *) this);
}
/* Publish a message to a topic according to MQTT rules and syntax */
@@ -153,7 +151,7 @@ public:
char dst[1024];
size_t dst_length = protocol::formatMessage<true>(dst, message.data(), message.length(), OpCode::TEXT, message.length(), false);
webSocketContextData->topicTree.publish(std::string(topic), dst, dst_length);
webSocketContextData->topicTree.publish(topic, std::string_view(dst, dst_length));
}
};