Webklex / laravel-imap

Laravel IMAP is an easy way to integrate both the native php-imap module and an extended custom imap protocol into your Laravel app.
https://www.php-imap.com
MIT License
641 stars 182 forks source link

Keeping the client connected #429

Closed marcmaalouly closed 2 years ago

marcmaalouly commented 2 years ago

Hello @Webklex , first thank you for this amazing package. I have a question, i'm using you're package in a SPA website using APIs and of course Laravel is the back-end server. After establiching the clients connection i couldn't find any way to keep this connection opened. `$oClient = \Webklex\IMAP\Facades\Client::make([ 'host' => $host, 'port' => $port, 'encryption' => 'ssl', 'validate_cert' => true, 'username' => $username, 'password' => $password, 'protocol' => 'imap' ]);

    $oClient->connect();`

This is the code i'm using to connect in an API call. After creating another API that simply returns the bool of $oClient->isConnected() i noticed it's always false when calling another API instance. Is there any way to save the connection? APIs are sessionless so i couldn't use Sessions.

Webklex commented 2 years ago

Hi @marcmaalouly , not really, given this is php. However depending on your use case, the IDLE command might be useful for you.

Best regards & happy coding,