Comments (5)
Also, I can notice that in the example/obsclient
we are trying simple Receive() which timeouts observation after 2 sec: https://github.com/dustin/go-coap/blob/master/example/obsclient/obsclient.go#L37
This timeout must be modifiable, as we might decide to wait on receive for a long time in a separate goroutine (we observe some value and we do not know in which moment the value will come - after 2 seconds or after 10 minutes...)
from go-coap.
Hi,
I generally don't contribute to github, so I am not sure how it all works.
I have my own fork where I have addressed the issue, because our solution requires a control over response timeout at client level.
Here is a single commit where I address the issue. I have added a test case to verify that I have addressed timeout:
The solution I chose is backwards compatible, but it introduces new variant of Dial function. I added a variable to track timeout parameter. I have renamed original ResponseTimeout to be DefaultResponseTimeout, because I wanted to make sure I've got all use cases and because its meaning is to be the default.
I am personally not sure if it would've been better to request for timeout as an argument to Send call. Compatibility and simplicity of API won over and I added response timeout to Connection structure instead.
If there is an interest in merge, I will request a pull for merge.
from go-coap.
from go-coap.
Context is a very good approach. I did not even think about it as I don't usually use it because of similar reason of code base older than context. I've used context concept in .NET apps and it is a great solution to many issues with logical operation context.
from go-coap.
@dustin I definitely agree that utilizing context.Context
is the way to go here. You can model it after what net/http
does and make the context a part of the coap.Message
. Handlers would be expected to respect ctx.Done()
as they are in HTTP these days.
from go-coap.
Related Issues (20)
- Implement BinaryMarshaler and BinaryUnmarshaler for Message
- Doesn't parse token HOT 4
- panic occured! HOT 4
- Implement message retransmission of CON messages HOT 2
- TCP CoAP support
- Unit tests failing HOT 3
- Implement CoAP Blockwise Transfers HOT 4
- DTLS Support HOT 4
- Websocket Transport HOT 3
- what about block HOT 2
- coap.ParseMessage is private
- How to define Resources or Endpoints on ServerSide? HOT 3
- Data From go-coap client is not reaching Java coap-californium server HOT 3
- Implement observe draft
- coap.ServeMux does not support root path ("/") handler
- How to Handle URL Parametrs
- Example server type assertion doesn't work, causes example to not work HOT 5
- Ridiculously low, hard-coded response timeout HOT 1
- Can anyone help manage the pull requests here? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-coap.