hono icon indicating copy to clipboard operation
hono copied to clipboard

Pass through user defined headers/properties for commands

Open thjaeckle opened this issue 5 years ago • 5 comments

For the HTTP protocol it would be really useful to leverage defined HTTP headers (e.g. for caching like "ETag", "Age", "Expires") for command messages issued via the HTTP long polling response.

This could be achieved by mapping all custom "application properties" of the AMQP 1.0 message as HTTP headers. For other protocols this might be useful as well. Of course for MQTT 3.1.1 this would not be the case, there passing through headers would probably not have an effect.

What do you think about that proposal?

thjaeckle avatar Nov 21 '19 17:11 thjaeckle

Are we talking about forwarding headers from devices to downstream messages or vice versa or both? Not sure if I understand correctly how you want to employ the Age and Expires headers in this context, though ...

sophokles73 avatar Nov 21 '19 17:11 sophokles73

Well, both directions would be great of course. That way one could specify arbitrary headers (if the protocol supports it). The caching headers could be used to indicate for a device connecting via HTTP when to again try to send data - but this was just an example.

The HTTP spec defines a lot of standard headers, just thought that it would be good to be able to leverage the standard.

thjaeckle avatar Nov 22 '19 13:11 thjaeckle

The caching headers could be used to indicate for a device connecting via HTTP when to again try to send data - but this was just an example.

Sorry, I do not think that I understand. Can you elaborate a little more?

sophokles73 avatar Nov 22 '19 13:11 sophokles73

One simple example: using the If-None-Match header A device could send telemetry data via HTTP defining the header If-None-Match: "42". Then the northbound application only needs to "update" the device when the sequenceNumber (or whatever is sent as value of the header) of the managed device is not "42".

HTTP defines tons of headers and behavior to apply, many of them for caching.

thjaeckle avatar Nov 22 '19 14:11 thjaeckle

Ok, I see what you mean. However, the main purpose of Hono is abstraction of the underlying transport protocol. Thus, FMPOV we need to make sure that we map the HTTP specific headers to generic AMQP application properties which we can also map from/to other transport protocols. Otherwise we would end up with downstream applications depending on a device being connected using a particular transport protocol.

sophokles73 avatar Nov 22 '19 15:11 sophokles73