emqx / emqx-coap

EMQX CoAP Gateway
https://www.emqx.com
Apache License 2.0
62 stars 34 forks source link

Can't start coap plugin #64

Open tmsvr opened 6 years ago

tmsvr commented 6 years ago

Environment

emq 2.3.1 in docker, official image from here

Expected behaviour

I can start the coap plugin from the dashboard and I can connect to it with clients (Caliornium).

Actual behaviour

Started image with: docker run --rm -ti --name emq -p 18083:18083 -p 1883:1883 -p 5683:5683 -p 5684:5684 -v /my/certs/are/here:/etc/certs emqttd-docker-v2.3.1:latest

Dashboard shows up, I set up the certificates then turn on the coap plugin. Dashboard shows it is ok, but it doesn't show up under listeners. In the logs I see

13:13:42.856 [error] CRASH REPORT Process <0.1562.0> with 0 neighbours exited with reason: {cannot_listen,5684,{options,{ciphers,[]}}} in gen_server:init_it/6 line 344

Cert was generated using this tutorial (CA + Server with unprotected key). If I try without certs (emptying the 2 fields for the cert and key) the result is:

13:17:30.443 [error] CoAP: certfile [] or keyfile [] are not valid, turn off coap DTLS

Dashboard still shows it is started ok, but not visible under listeners, and I can't connect. I have tried both 5683 and 5684 ports with no luck.

qingchuwudi commented 4 years ago

CoAP uses UDP ports, so you should use -p 5683:5683/udp -p 5684:5684/udp instead.