New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instant updates (push notification support) #6544

alecpl opened this Issue Dec 5, 2018 · 3 comments


None yet
2 participants
Copy link

alecpl commented Dec 5, 2018

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:

  1. Websocket client (frontend) that receives signals from backend and updates the UI.
  2. Websocket+HTTP service (backend) that handles connections from imap notification services and passes them to the frontend (with some format conversion or other logic).

The frontend part would be simple javascript code. It could receive simple messages like general "refresh folder X unseen count", "refresh folder X's messages list" or depending on the other part it could be more precise "set folder X unseen count to Y" or "Mark message X as seen". The frontend don't need to know about what type of notification system is used by the backend.

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 ( 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.

@alecpl alecpl added this to the later milestone Dec 5, 2018

@alecpl alecpl self-assigned this Dec 30, 2018

alecpl added a commit that referenced this issue Jan 7, 2019


This comment has been minimized.

Copy link
Member Author

alecpl commented Jan 7, 2019

Proof-of-concept in Any help will be appreciated.


This comment has been minimized.

Copy link

HLeithner commented Feb 8, 2019

Really interesting idea, did you considered reactphp? I did paid work with it last year and it was really easy and stable to use.

Have you checked if dovecot web would support websockets directly?


This comment has been minimized.

Copy link
Member Author

alecpl commented Feb 8, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment