Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoAP Put error #59

Closed
Zengpeng21 opened this issue Nov 4, 2017 · 5 comments
Closed

CoAP Put error #59

Zengpeng21 opened this issue Nov 4, 2017 · 5 comments
Assignees
Milestone

Comments

@Zengpeng21
Copy link

I want publish a message to a topic, which topic name is topic1/toic2.
So, I put a message to the url : "coap://localhost/mqtt/topic1%2Ftopic2?c=client1" but put has error.

tips: If I put the message to the url: "coap://localhost/mqtt/topic1?c=client1", it will success.

@grutabow
Copy link
Contributor

grutabow commented Nov 5, 2017

What is your coap client? libcoap?

@grutabow
Copy link
Contributor

grutabow commented Nov 5, 2017

Please share your emqtt log, such as log/error.log, log/erlang.log.1. Thanks!

And what is your emqttd version?

@Zengpeng21
Copy link
Author

coap client: californium

log/error.log:
2017-11-05 19:34:16.529 [error] <0.482.0>@emq_coap_resource:coap_put:76 CoAP-RES: put has error, Prefix=[<<"mqtt">>], Name=[<<"topic1">>,<<"toic2">>], Content={coap_content,undefined,60,<<"text/plain">>,[],<<"helloworld!">>}
2017-11-05 19:34:36.530 [error] <0.360.0> Supervisor {<0.360.0>,coap_channel_sup_sup} had child {{127,0,0,1},49988} started with {coap_channel_sup,start_link,undefined} at <0.479.0> exit with reason killed in context child_terminated
2017-11-05 19:34:36.530 [error] <0.480.0> gen_server <0.480.0> terminated with reason: killed
2017-11-05 19:34:36.530 [error] <0.480.0> CRASH REPORT Process <0.480.0> with 0 neighbours exited with reason: killed in gen_server:terminate/7 line 812

Other log files are not recorded.

@Zengpeng21
Copy link
Author

emqttd version: 2.3

@justina111
Copy link
Contributor

You can change your url to "coap://localhost/mqtt?c=client1", and set the uri_path option of "topic1/topic2" separately by the method "addUriPath", then the uri_path won't be split by "/". For example, you can make your put like,
String resourcePath = "topic1/topic2";
String uri = "coap://localhost/mqtt?c=client1”;
Request request = Request.newPut();
request.setURI(uri);
request.getOptions().addUriPath(resourcePath);

Hope it will help you.

@emqplus emqplus added this to the 2.3.0 milestone Nov 18, 2017
@emqplus emqplus changed the title put has error CoAP Put error Nov 18, 2017
@emqplus emqplus closed this as completed Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants