Do you have a reproducer? The
Ktor chat sample
does keep the connection open indefinitely without any extra effort. The reason that you can't observe the ping/pong is probably as usual: Ping/pong sits on a lower layer of your protocol stack. So it is an implementation detail that is not intended to be noticed by upper layers (like you wouldn't expect to see ACK messages when sending data over TCP).
Using the Ktor chat sample, you can check ping/pong on an idle connection if you add
<logger name="io.ktor" level="trace"/>
to
chat/src/backendMain/resources/logback.xml
and start the sample with an environment variable `KTOR_LOG_LEVEL=TRACE ./gradlew run`: