sessionworker implementation to handle session opening and closing etc