Tony
08/19/2024, 8:35 PMhttp.Server examples, but I cannot figure out the idiomatic way to handle something like a callback. I'd like to define a function like this:
toit
start-server [--on-open] [--on-close] [--on-message]:
...
server.listen server-socket :: | request/http.RequestIncoming writer/http.ResponseWriter |
...
But I cannot use the the passed in blocks (eg, --on-open) inside the lambda passed to server.listen.
What is the idiomatic way to do this in Toit?Tony
08/19/2024, 8:39 PMstart-server?Tony
08/19/2024, 8:48 PMkasperl
08/20/2024, 6:25 AMserver.listen call takes two arguments, the last one is a lambda.kasperl
08/20/2024, 6:25 AM--on-open to take a lambda instead, perhaps?kasperl
08/20/2024, 6:26 AMstart-server --on-open/Lambda --on-close/Lambda --on-message/Lambda:Tony
08/20/2024, 6:27 PM