Websocket CIO client and netty websocket server - ...
# ktor
n
Websocket CIO client and netty websocket server - both hides under the hood PING/PONG packets, right? I see this ping pong packets via wireshark but this code never was invoked:
Copy code
incoming.mapNotNull { it as? Frame.Ping }.consumeEach { frame ->                
                println("ping arrived")
}
I want to use ping/pong packets to determine user online status. it is correct way or no?
📝 1
e
Yep. There are two WebSocket session types in ktor-client: default and raw. Default session handles ping/pong. So you just can set the ping/pong timeout
n
wow, cool. Thanks for answer. Now I will try to work with Raw session.
hmm, theoretically, for tracking user online status, maybe it is a good idea that defaultWebSocket session expose outside the time when last packet arrived from TCP connection? No need to implement pinger/ponger if implementing raw websocketsession.