Coder Social home page Coder Social logo

Comments (11)

sbernard31 avatar sbernard31 commented on June 27, 2024

The question is maybe why someone would like to handle response timeout on its own ?

I don't know if there is good reason. 🤔
In my case, this is maybe a not so good reason... I already implement it and when I integrated v6.12.0 and I wanted to go back to previous behavior without going deeper in this new feature.

Maybe instead I should use the new feature correctly.
Here some question to be sure it match my needs :

  1. This responseTimeout can be set at CoapServer level but also at CoapRequest level using RESPONSE_TIMEOUT in Transport Context ?
  2. How does is work with BlockTransfer ?
  3. Is there a way to know if this is a ResponseTimeout or a CoAP Reliability Timeout ? I think both failed in a same way raising a CoapTimeoutException ?

from java-coap.

sbernard31 avatar sbernard31 commented on June 27, 2024

Not directly linked but reading the code, I see that there is also a responseTimeout for notificaiton :

Service<SeparateResponse, Boolean> sendNotification = new NotificationValidator()
              .andThen(new BlockWiseNotificationFilter(capabilities()))
              .andThen(new ResponseTimeoutFilter<>(timer, req -> req.getTransContext().getOrDefault(RESPONSE_TIMEOUT, responseTimeout)))
              .andThen(Filter.of(CoapPacket::from, CoapPacket::isAck))
              .andThenMap(midSupplier::update)
              .andThen(retransmissionFilter)
              .andThen(piggybackedExchangeFilter)
              .then(sender);

Not sure to get the meaning of this ? 🤔

from java-coap.

szysas avatar szysas commented on June 27, 2024

I assume that by saying 'mandatory' you mean it always have some value, and if not specified in CoapServerBuilder it will use default value (2 minutes).
It's purpose is to timeout:

  • NON confirmable transactions
  • Transaction with separate response.
  • Any block transfers

Are you suggesting that there are use cases where there is no need to have a timeout guard for some transactions?

  1. This responseTimeout can be set at CoapServer level but also at CoapRequest level using RESPONSE_TIMEOUT in Transport Context ?

That's true. Setting it in CoapRequest will overwrite CoapServer one.

  1. How does is work with BlockTransfer ?

Timer starts on first block and is not restarted on each block.

  1. Is there a way to know if this is a ResponseTimeout or a CoAP Reliability Timeout ? I think both failed in a same way raising a CoapTimeoutException ?

That's true. We could easily add cause for timeout exception if you see a need.

from java-coap.

szysas avatar szysas commented on June 27, 2024

Not directly linked but reading the code, I see that there is also a responseTimeout for notificaiton :

It is used to timeout outgoing observations.

from java-coap.

sbernard31 avatar sbernard31 commented on June 27, 2024

I assume that by saying 'mandatory' you mean it always have some value, and if not specified in CoapServerBuilder it will use default value (2 minutes)

Yep, that what I meant

from java-coap.

sbernard31 avatar sbernard31 commented on June 27, 2024

Are you suggesting that there are use cases where there is no need to have a timeout guard for some transactions?

Not really, I was more thinking about cases where java-coap user implements its own way to handle coap response timeout. (which is my case for now).

For me, maybe it's better to consider to reuse coap response timeout from java-coap (let's see if this is possible)
In a more general perspective, I guess being able to deactivate could make sense but I haven't strong argument (as maybe for me there is another way)

from java-coap.

sbernard31 avatar sbernard31 commented on June 27, 2024

That's true. Setting it in CoapRequest will overwrite CoapServer one.
Timer starts on first block and is not restarted on each block.

That sounds good to me.

That's true. We could easily add cause for timeout exception if you see a need.

To have exactly same behavior than what I have currently I need something like this.

from java-coap.

sbernard31 avatar sbernard31 commented on June 27, 2024

It is used to timeout outgoing observations.

I'm not sure I get it.
This is about sending Notification right ?
But a notification is either a CON or a NON ?
For NON there is nothing to timeout ?
For CON no need to response timeout as there is reliability timeout out (based on ACK + retransmission)
Or maybe this is about Notification with blockwise ?

from java-coap.

szysas avatar szysas commented on June 27, 2024

Yes, you're right, for sending notifications there is no use of it. Not even for blockwise transfer as we only notify first block and the rest has to be requested by recipient (so it's separate transaction).

In general, in your use case maybe better to set it to something big and handle timeouts in leshan. Just remember to call cancel on response's CompletableFuture.

from java-coap.

szysas avatar szysas commented on June 27, 2024

Reopen if you think there is still something more to discuss.

from java-coap.

sbernard31 avatar sbernard31 commented on June 27, 2024

In general, in your use case maybe better to set it to something big and handle timeouts in leshan. Just remember to call cancel on response's CompletableFuture.

I do not like so much the idea about having big value instead of deactivating but I can live with it for now.
(I may come back to you on this later when I will be in a more polishing phase)

Thx for you help 🙏

from java-coap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.