refactor session and transport and fix close and heart beat