fixed araqne/issue#62. added periodic ping and fixed hang when server closes session first