-
-
Notifications
You must be signed in to change notification settings - Fork 156
Description
This supersedes JKRhb/node-red-contrib-coap#15.
Currently, the API of node-coap requires you to select whether you want to create a v4 or a v6 socket; this property is inherited from the dgram.socket APIs. However, when connecting via a DNS name, this should be automatically selected based on the DNS records that are found. If I send something to coap://lamp1a/lamp/dimming, and lamp1a returns an AAAA record, the API of node-coap should be able to auto-select a v6 socket. Manually selecting v4/v6 should only be a thing for listening sockets, not for sending sockets.
That said, the NodeJS dgram.createSocket API doesn't seem to comprehend this. I am not sure how this should be solved in NodeJS, especially since the socket.send API allows to supply a hostname. It seems to me that DNS lookups and connection management should be handled outside of the dgram API.