About Detecting Client's Abnormal Disconnection and Handling it

I have a question about client’s abnormal disconnection.

In case of poor internet connection or unexpected situation, the clients sending RTMP would be disconnected from the session.

In order to catch and handle those situations, I’ve set PingTimeout and ValidationFrequency properties into Application configurations, but it just print out ‘pingtimeout’ logs. However, I need to operate handling abnormally disconnected session logics to handle ping timed-out session for managing our services.

So how can I catch pingtimeout event at the codes? Is it possible to figure out if the session disconnection event is normal or abnormal, and handle it at onDisconnect or onUnpublish event?

Thank you in advance