linagora / jmap-client-ts

JMAP 1.0 client library in TypeScript
MIT License
39 stars 16 forks source link

Support push notifications for Mailbox #33

Open alagane opened 3 years ago

alagane commented 3 years ago

Push documentation https://jmap.io/spec-core.html#push

We should be able to open a communication channel using websockets to receive StateChange notifications. The library should take care of the authentication.

For an authentication and request example using ticket on James: https://github.com/linagora/tmail-backend/pull/78/files#diff-652928d50d74bf6233709ab2fb095e4909b554d8e6b3ede18785277964803795

Given a client with session fetched
When call the method to get push notifications
And there is an error getting the ticket (Authentication)
Then the returned observable throws an error

Given a client with session fetched
When call the method to get push notifications
And there is an error opening the websocket (with ticket) Then the returned observable throws an error

Given a client with session fetched
When call the method to get Mailbox push notifications
And a Mailbox is added Then the returned observable emits the StateChange for the Mailbox TODO How do we know the observable is ready to receive StateChange when the Mailbox is added?

Given a client with session fetched
When call the method to get Mailbox push notifications
And an Email is added Then the returned observable does not emit the StateChange for the Email TODO How do we know the observable is ready to receive StateChange when the Mailbox is added?

chibenwa commented 3 years ago

@alagane can you describe a bit more the work to be done, and add a Definition of done?

alagane commented 3 years ago

Added these lines.

We should be able to open a communication channel using websockets to receive StateChange notifications. The library should take care of the authentication.

For now we encounter problems with authentication, because it is not possible to send HTTP headers with websockets for web browsers, and this is blocking. See https://github.com/linagora/james-project-private/pull/99

chibenwa commented 3 years ago

What do we do once we receive StateChanges from the library?

alagane commented 3 years ago

What do we do once we receive StateChanges from the library?

Well, it is not the responsibility of the library I suppose. Library user can make a /changes request then.

Arsnael commented 3 years ago

By lib user you mean inbox app?

alagane commented 3 years ago

By lib user you mean inbox app?

Yes, but there could be other lib users.

Arsnael commented 3 years ago

Yes, but there could be other lib users.

For sure, I just wanted to be sure of the meaning here. Thanks :)