How do I enable IMAP IDLE on z-push?



  • Hi,

    I am using z-push for some years now. Installed it “just for fun” on my home server (running Debian stable on amd64).

    My mail server is postfix/dovecot, my webserver is Apache (with php-fpm, NOT libapache2-mod-php), all as installable on Debian, no backports or third party repositories. All of these services (apache, postfix, dovecot, z-push) run on the same machine.

    z-push is version 2.4.5, vanilla install from tar.gz. It uses the CombinedBackend provider and connects to dovecot via IMAP on localhost port 143.

    I have configured my old iPad 2 (on iOS 9.3.5) and my Samsung Galaxy J5 2017 (Android 7.0, using the latest GMail app) to act as ActiveSync clients. Synchronization of emails, contacts, calendar and tasks works very well. According to z-push-admin, ActiveSync version 14.0 is used with both devices.

    BUT: I often read that z-push can be used for push mail on iOS devices. Neither the iPad nor the Samsung do immediately receive incoming emails. It takes a few minutes until new mails are synchronized.

    Dovecot advertises IDLE in its capabilities and this works when using K-9 email app (on Android) and Mozilla Thunderbird (on Linux and MS Windows). Incoming emails are immediately displayed.

    So I tried running “tshark -i lo -f ‘tcp port 143’” and I don’t see the IMAP client (z-push) sending an IDLE command to dovecot.

    My question is: is IMAP IDLE configurable in z-push? If yes, where do I enable it? A quick recursive case-insensitive grep on the z-push folder did not show any match.

    Or does anybody have an idea what could be the reason why push doesn’t work for me?

    Any hint is appreciated.

    Thanks!
    Sven


  • Kopano

    Hi Sven,

    Z-Push IMAP backend uses the standard PHP imap_* functions which as far as I know don’t support IMAP IDLE.

    However a few minutes sounds a lot, if you haven’t changed PING_INTERVAL value in Z-Push config, it should be not more than 30 seconds (plus some time for the sync request).

    Manfred



  • Hi Manfred,

    thank you very much for your reply.

    Now I understand, push isn’t realized by using IDLE, but by short consecutive IMAP logins. That explains why I never saw an IDLE command in tshark.

    I didn’t change the PING_INTERVAL setting, it is set to 30 seconds as you mentioned.

    Is running z-push under php-fpm a problem? Of course I set the php_flags in /etc/php/fpm/pool.d/www.conf and raised max_execution_time and memory_limit in /etc/php/fpm/php.ini. I googled for a somewhat official sample php-fpm configuration, but didn’t find anything.

    Thanks again,
    Sven


  • Kopano

    Hi Sven,

    Z-Push also works fine under PHP-FPM.

    There is sample PHP-FPM configuration in the nginx config files: https://stash.z-hub.io/projects/ZP/repos/z-push/browse/config/nginx/z-push.conf.

    There also is an example nginx PHP-FPM configuration for webapp in the Kopano knowledge base: https://kb.kopano.io/display/WIKI/Nginx#Nginx-InstallNginxandphp-fpm.

    There are also some threads here in the forum regarding Z-Push usage under PHP-FPM.

    Manfred



  • Hi Manfred,

    thanks for the links. I found the first one when googling, but it covers nginx and not apache. I was unsure how to translate nginx options like “fastcgi_read_timeout 3660” to apache syntax (I decided to translate it to “Timeout 3660” in the vhost section).

    Thank you!
    Sven