Closed Zengpeng21 closed 6 years ago
What is your coap client? libcoap?
Please share your emqtt log, such as log/error.log, log/erlang.log.1. Thanks!
And what is your emqttd version?
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.
emqttd version: 2.3
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.
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.