https://kotlinlang.org logo
#ktor
Title
# ktor
s

Srki Rakic

02/13/2023, 4:19 PM
Can someone help me understand the
wait
flag? I've noticed that if I don't set it to true the web server is not serving requests even though the output is
ktor.application - Responding at <http://0.0.0.0:8080>
indicating that it should.
Copy code
embeddedServer(Netty, port = 8080) {
  app(dependencies)
}.start(wait = true) // vs .start()
p

phldavies

02/13/2023, 4:21 PM
.start(wait = true)
will suspend at the callsite until the server is stopped/shutdown. If you don’t have this and the containing scope is completing, it’s likely that ktor is stopping straight away before any requests can be actioned (I could be wrong though)
s

Srki Rakic

02/13/2023, 4:30 PM
I believe you are correct.
9 Views