I need to create, in Node JS, a list of "subscribers" which will provide a device (string) for which they want to receive notifications when there is new data from, and the IP and Port (both strings) to forward the data. The list should be unique; i.e., there should only be just one combination of (device, IP, Port) in the list. I also need to efficiently get a sub-list of IP/Port of subscribers when data come from a device, to know where to forward the data to.
In other languages, I was using Associative Arrays for this (with Unique index), so using something like this;
subscribers[device] = (IP,Port)
solved the problem. So when new data comes from a device, filtering the array with the device index, gives me a list of subscribers to forward the data to.
I'm wondering what is the best approach to implement this in Node JS. I was looking at Arrays, but I don't find Associative Arrays, and I'm not sure if another way would be a better approach...
Thanks in advance Gus