Current Lua downloadable firmware will be posted here

User avatar
By alfacom
#50735 Hi. I have a two esp-12q with nodeMCU 1.5.1 firmware and I have a problem with using a coap module.

I have started a coap server on first esp:

Code: Select all    cs=coap.Server()
    cs:listen(5683)
    test='[1,2,3]'
    cs:var("test", coap.JSON)

Test on Firefox with copper plugin got the right results.

But, if I want to use the second esp-12q with similar firmware to get this value from the first esp I get a problem - my code does nothing, because in the documentation for coap module there is no way to accept response.

Code: Select all    cc = coap.Client()
    cc:get(coap.CON, "coap://192.168.10.11:5683/v1/v/test")  -- and the response goes to... to where?

Question: Is there a way to get an answer as client?

In the mind comes only a bunch of client + server on each esp, where client1 makes a POST-request to a server2 to a function, that sends a reply as a POST-request from client2 to server1 to a function, that finally save the data.
client1 -> server2 -> client2 -> server1
User avatar
By marcelstoer
#50769 http://nodemcu.readthedocs.io/en/latest ... ules/coap/ says it all I believe:

This module implements both the client and the server side. GET/PUT/POST/DELETE is partially supported by the client. Server can register Lua functions and variables. No observe or discover supported yet.

Caution
This module is only in the very early stages and not complete yet.


Also, there are a number of open CoAP issues: https://github.com/nodemcu/nodemcu-firm ... Aopen+coap