Open sbernard31 opened 2 months ago
Easy one would be to add helper method, would that be enough?
I'm not sure to see how it will looks like ?
Something like:
static InetSocketAddress getPeerAddress(Object coap) {
...
static TransportContext getTransportContext(Object coap) {
...
OK I get it but my question was more about having a kind of Parent class (e.g. CoapMessage
) for CoapRequest
, CoapResponse
, SeparatedResponse
. At first sight (maybe I'm wrong) I think this could make java-coap user code more elegant.
Regarding adding this static method, to be honest, I'm not sure will really makes my user code better. :thinking:
Anyway, maybe better to work first on https://github.com/open-coap/java-coap/issues/84 and see if you also need this kind of abstraction in java-coap code too ?
I don't know if this is a good idea but I face some situation where I need to handle a coap request OR a coap (separated) response in a same way. This is not too surprising as from a CoAP RFC point of view all request and response are conceptually a CoAP Message.
In my case, I need the remote peer address and the transport context of the message. See :