Comments (17)
Faced with the same issue, used
client.useNONs();
I will look through code why Type.NON is ignored.
from californium.
Hi Eugene,
client.useNONs() seems to work.
Thanks,
James
On Wed, Jul 20, 2016 at 4:36 PM, Eugene Nikolaev [email protected]
wrote:
Faced with the same issue, used
client.useNONs();
I will look through code why Type.NON is ignored.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#75 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADkRp3McgjqeHWWSIPIe4ORZxoNctZ5sks5qXjJsgaJpZM4JQvg1
.
James Nguyen
Email: [email protected]
from californium.
A pull request has been added.
from californium.
I just did a git pull. Nothing has been updated.
On Wed, Jul 20, 2016 at 7:09 PM, Eugene Nikolaev [email protected]
wrote:
A pull request has been added.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#75 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADkRp6w7X3vpjRyF3iR75uXVFgErPIHZks5qXlZQgaJpZM4JQvg1
.
James Nguyen
Email: [email protected]
from californium.
from californium.
CoapClient
's send()
methods indeed set the request type to the client's configured default type (set via CoapClient.useNONs()
or CoapClient.useCONs()
as you already figured out). If you want more control over the specifics of the request you should use CoapClient.advanced(Request)
for sending synchronously or CoapClient.advanced(Request, CoapHandler)
for sending asynchronously instead.
These methods only set the passed in request's URI to the target URI set for the client.
I currently tend to therefore close this issue and the related PR unless you still feel that Californium should behave differently ...
from californium.
Thanks for reply!
Not sure if I 100% understand the points, but in my case, CoapCliient#advanced
uses CoapClient#asynchronous
(or synchronous) which uses CoapClient#send
.
So Request#type is never applied and it looks strange in the code:
CoapClient client = getClient(path);
client.useNONs();
Request request = new Request(code, Type.CON);
...
client.advanced(request);
// Actually the request will be CON
from californium.
Yes, I manually set the request and used client.advance() method, but the server treated the non-confirmable message as if it was a confirmable message.
On Jul 21, 2016, at 9:08 AM, Kai Hudalla [email protected] wrote:
CoapClient's send() methods indeed set the request type to the client's configured default type (set via CoapClient.useNONs() or CoapClient.useCONs() as you already figured out). If you want more control over the specifics of the request you should use CoapClient.advanced(Request) for sending synchronously or CoapClient.advanced(Request, CoapHandler) for sending asynchronously instead.
These methods only set the passed in request's URI to the target URI set for the client.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
from californium.
I could bear with it but it is not so convenient if client operations are incapsulated like this:
void nonPut(String path, byte[] payload) {
performRequest(path, payload, Code.PUT, Type.NON);
}
void conPut(String path, byte[] payload) {
performRequest(path, payload, Code.PUT, Type.CON);
}
...
So somewhere in the performRequest I have to have an if with useCONs/useNONs in clauses.
Though of course it's minor.
But I think such issues would be created multiple times because of confusion.
from californium.
Indeed, it is not.
I'd rather users more control of Request.
On Jul 21, 2016, at 10:07 AM, Eugene Nikolaev [email protected] wrote:
I could bear with it but it is not so convenient if client operations are incapsulated like this:
void nonPut(String path, byte[] payload) { performRequest(path, payload, Code.PUT, Type.NON); } void conPut(String path, byte[] payload) { performRequest(path, payload, Code.PUT, Type.CON); } ...
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
from californium.
@evgeniynickolaev,
after taking another look at the code, I guess you're right. the advanced()
methods also delegate to the same send()
method :-(
I guess we should move the request.setType()
from send()
to the convenience methods (post(), put(), get()
etc) then. This way, client code can use the advanced()
methods for sending a request that it has configured manually whereas the convenience methods can be used in the established way, e.g. by less experienced users. AFAIK we should also make sure that the target URI can be set explicitly when using advanced()
.
What do you think?
from californium.
Oh, yes, I see your point, it will be great and will solve the issue.
But CoapClient#send
should anyway set the type if Request#type
is null otherwise we can break some legacy code.
May I make another pull request?
from californium.
That's true, however, this issue already came up in another context (TCP support) and we thought that it seems strange that we even allow for a Message
being created without a type being set/supplied. I think we should tackle the issue at its source and set the type to e.g. CON by default in the Message
constructor ...
from californium.
So I should also add CON by default to the Message. OK, I like it.
from californium.
That'll be helpful. :)
On Jul 21, 2016, at 12:01 PM, Eugene Nikolaev [email protected] wrote:
So I should also add CON by default to the Message. OK, I like it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
from californium.
I've added a new pull request
from californium.
I've added a pull request with the review comments applied.
@sophokles73, could you please revise it?
from californium.
Related Issues (20)
- Notification on CoapResource removal HOT 6
- Java 7 - no more direct support by the Eclipse CI HOT 11
- Minor Release 3.11.0 - Available HOT 1
- blockwise transfer: implementation error, peer requested block offset Y but resource returned block offest 0 HOT 6
- Californium initiates a DTLS handshake when running on server side HOT 8
- Enabling github Discussions?
- How to clear ongoing observe notifications from transit on CoapEndpoint stop? HOT 16
- lwm2m-service deployu in k8s,can not return client message HOT 4
- [Firmware Update][Blockwise] - Is it possible transfer a firmware more than 300MB using Blockwise? HOT 5
- Minor Release 3.12.0 - Available HOT 1
- Growing Memory Utilisation - CF-Secure server implementation with CustomPskStore HOT 7
- Question about Key ID Context CBOR coding in OSCORE HOT 3
- Always a 5.02 response in ProxyHttpClientResource if http response contains no content-type header HOT 14
- cf-server certificate doesn't match HOT 7
- Issue with running Contiki-NG with latest release of Leshan (2.0.0-M15) HOT 33
- Bugfix release 3.12.1 - Available HOT 2
- `nonPublicPartOfAPI` for `EpochMessage` reported by revapi HOT 1
- OptionValue is empty when client post a request with MediaTypeRegistry.TEXT_PLAIN HOT 2
- Dtls secure renegotiation client error when no extensions are used HOT 8
- Dtls abbreviated handshake is not working when client is in DtlsSecureRenegotiation.NEEDED mode 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 californium.