lorawan-server
lorawan-server copied to clipboard
is it possible to define one websocket for all lora devices?
@gotthardp I am not familiar with erlang programming so I cannot dig into the codes to find the answer.
By defining a websocket connector /ws/uplink/{devaddr}, I can send data in my program by creating a websocket to ws://localhost:8080/ws/uplink/mydeviceaddr. But in my product, I have more than 10 devices. I don't want to create a websocket for every device. Is there a way to create a single webosocket so that my program can use this single websocket to send data to any device?
In a test, I simply define the connector with URL = /ws/test, but the data cannot be sent to the lora device, even I specified the "devaddr" attribute in the JSON data. But it is interesting that on the test webpage http://localhost:8080/admin/ws.html, I can see the data that is sent from the Lora device (I have a serial port in my PC which can sent message from the PC to lora device).
Any help is highly appreciated.
@jianyingl Hello, you can't do that with websockets, but you can do that with usual simple http/https. Have a look into Connectors.md in the docs.
Minimal config will be:
Format: JSON
URI: http:
Received Topic: /downlink/{devaddr}
An input only http connector will be created, which you can use to post data to your devices with a URL http://<yourserver>:8080/downlink/<devaddr>