Symfony auto logout event not listening

I've create a event that listen when the user is logged out. This event is triggered when the user goes to "logout" page. But if the user is disconnected because of the session time out (I guess), this event is not triggered.

I need this in order to limit one user per account logged at the same time (cause one account in common to several users)

class Logout implements LogoutHandlerInterface

     * @var ObjectManager
    private $manager;

     * @var \Swift_Mailer
    private $mailer;

    public function __construct(ObjectManager $manager, \Swift_Mailer $mailer) {
        $this->manager = $manager;
        $this->mailer = $mailer;

    public function logout(Request $request, Response $response, TokenInterface $token)
        /** @var User $user */
        $user = $token->getUser();

Read more here:

Content Attribution

This content was originally published by lucrece at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: