Thanks for the insight. Yet another example how powerful and complex these drivers can be. My coding skills are zero so I just need to wait what you guys come up with.
Fun fact, having multiple ādevicesā on a single raspberry pi was my original reason for starting thinking about the project that eventually became Edge Drivers. DTHs were so inextricable tied to MAC addresses that it basically would have never been possible to make them work this way.
I was thinking of a solution to this the other day. Can you configure your device to communicate over multicast address? If so, then you could kind of hack things and have your driver monitor the multicast and look for a āsignatureā in your deviceās transmission to pick out its messages. Definitely unconventional and wouldnāt follow any protocol standards but it might work. I may try this approach for a Shelby motion detector I have that can send messages to a configured ip:port when motion is detected.
Yes! I absolutely do this; I have a RPI running all sorts of ādevicesā that Iām in the process of converting over to Edge driver(s).
I think that the SSDP - NOFITY will be useful in this case, i.e. the driver would be broadcasting its luxureās server IP and port.
This implementation would imply one additional step into the flow (driverās IP/PORT acknowledgement) but, will guarantee M2M communication.
In looking at the example LAN drivers I could find (all the way back to alpha code), Iāve seen a few different approaches with HTTP-related networking. Can you comment on these and is there one thatās most recommended?
http = require "socket.http"
http = cosock.asyncify "socket.http"
http = require "luxure"
The first is what you recommended in the beginning of this topic.
The second is from older examples and I have used per earlier guidance from Patrick
The third I know is a third-party HTTP module, but is socket.http preferred over this?
Iām rather desperate to find ways to reduce or eliminate the known platform socket errors, as I get them nearly all the time now - especially whenever I try to update a driver that is using HTTP calls.
And related to using something like luxure, how do we even know what Lua library options are available (in general) to us in the Edge environment? Is there a list somewhere?
Hey, @TAustin
The difference between using the socket
module from beneath cosock
or from direct import is that the cosock
implementation allows you to perform non-blocking socket operations.
And the luxure library, as its readme refers, is intended to build HTTP/TCP Servers, which is preferred over raw socket.tcp
servers because the library does the library already parses the HTTP strings into tables and allows you to enable custom middlewares in a express-like structure.
You can check the loaded libraries and modules looping the package.loaded
module.
Not sure this will really do what I was asking: I was wanting to get a list of ALL libraries available in the Edge environment, not a list of the ones my driver has loaded. For example, luxure doesnāt get listed unless I have it requireād in my driver.
I believe that right now it isnāt possible, however, Iāll comment it out with our engineers to check if it is possible to include at least a documented reference of the libraries available.
Documentation is good