Update.
Add comments.
Increate ping interval, decrease ping checking interval. Add ping message to avoid ping missing.