httpKeepAlive (Function)
Signature: httpKeepAlive(serverID: int) -> Result<int, Error>
Description: Makes the server hold the process open after the program's entry returns, until the server stops; answers 0, or an Error for an unknown server.
Parameters
- serverID (
int): Server identifier from httpCreateServer
Returns: Result<int, Error>
Example
fn held(server) = {
let kept = httpKeepAlive(server) ?: -1
let stopped = httpStopServer(server) ?: -1
"kept=${kept}; server stop=${stopped}"
}
print(match httpCreateServer(18896, "127.0.0.1") {
Success { value } => held(value)
Error { message } => "server error: ${message}"
})
held server = {
kept = httpKeepAlive server ?: -1
stopped = httpStopServer server ?: -1
"kept=${kept}; server stop=${stopped}"
}
print(
match httpCreateServer (18896, "127.0.0.1")
Success value => held value
Error message => "server error: ${message}"