Join GitHub today
Instant updates (push notification support) #6544
The old solution for instant notifications about changes in mailboxes is IMAP IDLE. This has however a big limitation which is a need to use a separate IMAP connection for every folder.
Recent versions of dovecot and cyrus provide APIs that could be used and might be better than IDLE. For example:
So, here's an idea how we could use it. A Roundcube plugin containing two components:
The backend part will be more complicated. I'm not sure it should be in PHP, but probably with libraries like Swoole it would be doable (https://www.swoole.co.uk/docs/modules/swoole-websocket-server). It would receive notifications from all kind of notification services with some driver-based API. All kind of notification formats would be converted to some internal format understood by the frontend and passed to it via websocket.
In cases when the notification does not contain all information, e.g. when it says "a message has been marked as seen", but not "how many unseen messages in that folder left", the backend could (having access to Roundcube session, i.e. user credentials) fetch the missing information from IMAP. But we can probably just fallback to asking Roundcube to do that request by itself.
added a commit
Jan 7, 2019
Proof-of-concept in https://github.com/roundcube/roundcubemail/tree/dev/push/plugins/push. Any help will be appreciated.
Nope. I didn't test reactphp and I didn't try dovecot yet. Replacing the engine from Swoole to something different should not be that hard, so we might consider that change in future if we have issues with Swoole. I didn't yet really test performance nor reliability of Swoole based solution.