-
-
Notifications
You must be signed in to change notification settings - Fork 35
Description
This should be a combination of the two channel handlers MQTTMessageHandler and MQTTTaskHandler.
MQTTMessageHandler doesn't need much of a rewrite. The only thing it needs is the removal of the reference to the client (It doesn't need this). It uses the client to do logging and accessing the connection to write new packets which can be written directly from the handler so shouldn't need the connection. I think this can be done in place, without breaking current code.
EDIT: The message handler does need the client at the moment to pass received publish messages back to the user. We should target for the channel handlers not to reference back to the client. It shouldn't be necessary.
MQTTTaskHandler will need more of a rewrite. It should hold an array of packets sent off to the server each with a Promise that should be completed when the resulting ACK, CONNACK or PINGRESP is returned. See the valkey promise implementation that allows us to support both NIO and Swift concurrency https://github.com/valkey-io/valkey-swift/blob/b5e8185d0564d722901e2ca606481f2c269309b0/Sources/Valkey/Connection/ValkeyChannelHandler.swift#L14