I am keeping connections to a list of servers represented by URLs. Each of them has a pid if connected.
Ideally, I’d like to have a simple list only containing the connected ones. It should also be possible to index by by URL to get a specific pid. Should also be easily updatable…
Been trying a keyword list such as
["google.com": #PID<0.109.0>]
But Keyword.get only accepts atoms as a key to get the pid, so, I am a bit confused as to if it’s the way to go or not… is there a better way to get this to work?
Yes you can use a registry which is something more advanced than plain data structure. For example you can’t use the simple Map.values function to get all your pids and you need to write an erlang spec to select them