Benoit Tellier created JAMES-3491:
-------------------------------------

             Summary: JMAP PUSH over WebSockets
                 Key: JAMES-3491
                 URL: https://issues.apache.org/jira/browse/JAMES-3491
             Project: James Server
          Issue Type: New Feature
          Components: JMAP
            Reporter: Benoit Tellier
            Assignee: Antoine Duprat


We will implement [RFC-8887 - A JSON Meta Application Protocol (JMAP) 
Subprotocol for WebSocket](https://tools.ietf.org/html/rfc8887) 
as a transport mechanism for PUSH notifications.

We will [generalize EventBus](0046-generalize-event-bus.md) in order to achieve 
an out-of-the box Publish-Subscribe 
system for JMAP related events, that do not fit in the mailbox API.

We will implement listeners registered on the JMAP event bus for WebSocket 
clients in order to carry over state changes
to the client.

We expect clients using the PUSH to lead to a drastic performance enhancement, 
as less data needs to be transmitted upon
resynchronisation.

As mentioned in RFC-8887 the usage of webSockets allows other performance 
optimizations:
 - Requests can easily be compressed, which is not doable over HTTP for most 
available implementation (HTTP request 
compression is not ubiquitous).
 - WebSockets being connected, authentication can be performed once, when 
establishing the connection. This can allow to
reduce the load, if needed, on authentication systems. It might ease the use 
for instance of custom OpenId connect 
providers.

People deploying JMAP need to be aware that load-balancing webSockets requires 
session stickiness.


{code:java}
 1. Bob authenticates against the `ws://` endpoints. Upgrade to websockets is 
granted.
 2. Bob registers Email and Mailbox updates. A listener listen for state 
changes related to Bob account.
 3. Bob receives a mail. The MailboxManager adds it to bob mailbox. An `Added` 
event is fired on the mailbox event bus.
 4. The `MailboxChangeListener` process the Added event, handles delegation, 
record the state change, and fires related
 events for each account on the JMAP event bus, for both `Email` (as there is 
an addition) and `Mailbox` (as the counts 
 were updated).
 5. Bob's webSocket listener receives a message from RabbitMQ and pushes it to 
bob.
 6. Bob's MUA is aware it needs to re-synchronize. It will perform resynch 
requests combining `Email/changes`, `Email/get`,
 `Mailbox/changes` and `Mailbox/get`.
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to