microsoft-graph-toolkit icon indicating copy to clipboard operation
microsoft-graph-toolkit copied to clipboard

Microsoft Graph API change notifications in Graph Toolkit

Open mohamedcherifmo opened this issue 3 years ago • 13 comments

Proposal: Add support for change notification when supported instead of using polling rate

Description

The Microsoft Graph API get change notifications provides a webhook mechanism to deliver change notifications to clients so would be great to have for things like the agenda component (and would love mgt-get to also have it)

Rationale

Preferred Solution

Additional Context

mohamedcherifmo avatar Sep 14 '20 04:09 mohamedcherifmo

Hello mohamedcherifmo, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

msftbot[bot] avatar Sep 14 '20 04:09 msftbot[bot]

Hi @mohamedcherifmo, thanks for submitting this proposal. This issue seems related to #264.

We believe this will need an additional service to support. Have you thought more about a solution for implementing webhooks in the toolkit?

shweaver-MSFT avatar Sep 15 '20 22:09 shweaver-MSFT

It’s a bit related to issue #264 but my thinking is more of: Phase 1:

  • For agenda (calendar view) and todo where the rate of change might not be too high I would do an initial retrieval which would be stored in browser cache / dB (together with the delta id)
  • polling can be used (as a phase 1) and polling would only retrieve the diff and update the local data store
  • on adding a task the task would be added to the data store triggering a re-render and server sync
  • the local data store would always be subidivided into server table and local table

This would give the benefit of only retrieving data when there are updates, support offline mode

The problem with this scenario is that the application won’t be real-time unless the polling rate is high enough to be near-real-time and in that case it’s going to be too chatty.

So as an alternative I’m thinking of utilising the service worker push notification to receive from the server any updates and update straight away (while still having polling for a minutely sync for instance)

mohamedcherifmo avatar Sep 18 '20 23:09 mohamedcherifmo

@mohamedcherifmo, I like your idea for polling, it would be easier to manage than setting up a separate service. Is this something that you'd be willing to prototype?

shweaver-MSFT avatar Sep 22 '20 22:09 shweaver-MSFT

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

msftbot[bot] avatar Sep 26 '20 23:09 msftbot[bot]

I've started trying out a few options. So far the idea i see would be best is indexedDB and delta sync. I'd certainly be interested to prototype it yes

mohamedcherifmo avatar Sep 28 '20 22:09 mohamedcherifmo

That's wonderful! Thank you 😊

Feel free to open up a draft PR with the prototype whenever you are ready.

shweaver-MSFT avatar Sep 28 '20 22:09 shweaver-MSFT

I managed to complete it as a Blazor Wasm app. Would you like me to convert it to pure html and JS Or would you like me to share it as is?

mohamedcherifmo avatar Oct 02 '20 00:10 mohamedcherifmo

Hey @mohamedcherifmo, that's so cool. Pure HTML and JS would be ideal (if possible) since most of us are not familiar with Blazor :)

nmetulev avatar Oct 14 '20 00:10 nmetulev

Ok will work on converting it and send the PR once completed :)

mohamedcherifmo avatar Oct 21 '20 00:10 mohamedcherifmo

Sorry for the late reply, was a bit busy but thankfully @hagarwahsh took the time to do it :). todo-indexdb-poc-master.zip

mohamedcherifmo avatar Nov 29 '20 14:11 mohamedcherifmo

Hello All , How scalable is this solution as there is a setTimeout function which polls every 2 mins. This will throttle the limit as in when it will be released to mass audiences.

I am having hard time with the Polling of MGT-GET as it is hitting the throttling limits when released to few audiences. As per the recommendations from MS is that we should not keep polling for the data to check the latest changes . Polling Recommendation

On the other hand we have the capability of polling in milliseconds out of the Box in Graph API toolkit. I cannot understand the significance behind it.

sohilbhalla avatar Mar 15 '21 09:03 sohilbhalla

Agree that polling is not an ideal solution for all workloads. Let's use this issue to track progress toward adding support for change notifications and discuss potential implementations. I'd imagine this would require the developer to provide a service that will hook into a documented interface on the mgt side. Fully open to thoughts, suggestions, and contributions.

nmetulev avatar Apr 01 '21 17:04 nmetulev