hello there,
i have an "output.harbor" with "on_connect" and "on_disconnect" functions.
these functions should add/remove the clients that connect/disconnect to a
list.
all clients should be output later in an api as json code
clientlist = ref []
def on_client_connect(~headers, ~uri, ~protocol, client) =
clientlist := list.add(client, !clientlist)
end
def on_client_disconnect(client) =
clientlist := list.remove(client, !clientlist)
end
http_api = json_of(!clientlist)
..that works finde.
but if i want the headers in this list too, i have the problem that the
"list.remove_assoc" function can't handle sublist. (client,[headers]).
clientlist = ref []
def on_client_connect(~headers, ~uri, ~protocol, client) =
clientlist := list.add((client, headers), !clientlist)
end
def on_client_disconnect(client) =
clientlist := list.remove_assoc(client, !clientlist)
end
http_api = json_of(!clientlist)
..error at startup.
after days of searching for a solution I have now given up finding a
solution myself.
the concrete problem is that "list[key]" causes an error when "key" itself
is a list.
is there a way to deal with this?
with friendly greetings
Steffen \ Prism-J
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users