feat: Seperates connection stream and moves connection manager out of the connection service module.

This commit is contained in:
2024-11-13 17:12:56 -05:00
parent b8992b89b6
commit bd2a798320
8 changed files with 254 additions and 213 deletions

View File

@@ -50,7 +50,10 @@ public struct TopicPublisher: Sendable {
public static func live(client: MQTTClient) -> Self {
.init(
publish: { request in
assert(client.isActive(), "Client not connected.")
guard client.isActive() else {
client.logger.trace("Client is not connected, unable to publish to \(request.topicName)")
return
}
client.logger.trace("Begin publishing to topic: \(request.topicName)")
defer { client.logger.trace("Done publishing to topic: \(request.topicName)") }
try await client.publish(