Hi Ktor Team! This is another question. How can I ...
# ktor
c
Hi Ktor Team! This is another question. How can I check ktor embeddedserver's status? For example, before start the server I want to check if the server is alive or not. Is there any solution? Thanks.
b
Ping a port and see if it's open?
c
I think that may have also some issue.
Copy code
environment.monitor.subscribe(ApplicationStarting) {
    isAlive = true
}

environment.monitor.subscribe(ApplicationStarted) {
    isAlive = true
}

environment.monitor.subscribe(ApplicationStopPreparing) {
    isAlive = false
}

environment.monitor.subscribe(ApplicationStopping) {
    isAlive = false
}

environment.monitor.subscribe(ApplicationStopped) {
    isAlive = false
}
I found a solution while I'm investigating on the ApplicationEngine source code.
WDYT, @Big Chungus?