Session handling connect middleware