How to get Isloggedin()

I often use

$someval=\OC::$server->getUserSession()->isLoggedIn();
echo $someval ? 'is logged in' : 'is not logged in';

To get whether user is logged in or not. This does not seem to get a result I am looking for in "__contruct() {…} " -function.
Is there a way to check whether user is logged also in construct?