microsoftgraph / microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒
https://docs.microsoft.com/graph/toolkit/overview
Other
945 stars 303 forks source link

Microsoft Graph API change notifications in Graph Toolkit #626

Closed mohamedcherifmo closed 8 months ago

mohamedcherifmo commented 4 years ago

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

ghost commented 4 years ago

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 🙌

shweaver-MSFT commented 4 years ago

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?

mohamedcherifmo commented 4 years ago

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

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)

shweaver-MSFT commented 4 years ago

@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?

ghost commented 4 years ago

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.

mohamedcherifmo commented 4 years ago

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

shweaver-MSFT commented 4 years ago

That's wonderful! Thank you 😊

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

mohamedcherifmo commented 4 years ago

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?

nmetulev commented 4 years ago

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

mohamedcherifmo commented 3 years ago

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

mohamedcherifmo commented 3 years ago

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

sohilbhalla commented 3 years ago

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.

nmetulev commented 3 years ago

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.

gavinbarron commented 1 year ago

Marking this as blocked.

Currently there is no good mechanism for supporting direct to browser change notifications and implementing poling is a nasty hack for this use case.

This should be revisited when Microsoft Graph supports direct to browser change notifications

sebastienlevert commented 8 months ago

I'll actually go and close this issue. It's unlikely "all" component will be able to rely on a consistent way to get change notifications in the browser. If the situation on Graph changes, we'll re-open and consider adding it. Thanks!