However, if you use push notifications - conflicts will be very rare. I will not cover that here much, but you will conflicts - that is when user modified same event in multiple sources.Store timestamp of last successfully pushed change (again, for every user provider) and if process has been interrupted - you know where to start over. There will be network failures, there will be conflicts, so you have to push changes sequentially, not in parallel (again, sequentially for every user provider pair, not globally). Instead use background process which pushes changes for each user provider pair one by one. But, do not do this immediatly when the change itself is made. Push changes made by your own application to target providers.Push notifications are not 100% reliable and some can be missed - you need to handle those using that nextSyncToken api. If you use push notifications - always also periodically poll events, but not often (like one every several hours). Just grab and store provided nextSyncToken and use it to make future requests. All this would be unreliable, but Google Calendar developers know how to make good sync api, so they took care of that for you. Note that you don't need to fetch whole list every time, nor do you need to provide some filter options (like "give me all events created after "). Here is a link describing how to implement push notifications and here is the link describing how to get only new events, that is events you (your application) didn't see before. You can either do this by polling (periodically checking if there are new events) or by making provider push events to you. Now you need to watch for new events coming from provider. Here is a reference to the structure of Google Calendar event and you see that all required metadata fields (created,updated, id) are present there. Initially fetch all events from target provider and store them in your database. Your own database with events, where event table has several important metadata columns: Created\Updated (time when event was last created or updated, not related to the date of event itself), Source (where this event came from, like Google Calendar, Outlook or your own app), UpdatedAtSource (source where this event was last modified), EventID (unique identifier of event - important to have that to prevent duplicates in certain cases). Below I will assumed we are working with Google Calendar only, hopefully Outlook is similar (but I did not check). Always making a query to all external sources (plus to your own database) is slow, makes synchronization much harder and limits you quite a lot, because you cannot for example filter or search events at multiple sources easily. I didn't look at Outlook, but Google Calendar api provides you all you need.įirst to answer your question - yes, you need to fetch all events (you may skip events in the past though) and store them in your own database. Most important is that the other party (google calendar and outlook in this case) should cooperate with you and provide an api to perform incremental synchronization. To be able to create reliable sync solution you need several things. If any change is done to those events via my application I should call the API of those applications to make that change into their application (Google calendar, Outlook etc). Seeing all that I feel that storing all the events of all those applications into our own application's db is not feasible. I.e they are allowing many different applications calendars/tasks to be synced into their calendar. I went to (one of the calendar sync web app) and noticed If a user wants to do any change in the events that should be updated directly to Google/Outlook calendars via their API calls of create/update and delete. Should I just do a GET via Google/Outlook API to fetch the events for a particular view where I am right now in my calendar (I will be having start data and end date of my calendar view) and just show them to my calendar (i.e I am not storing those external events in my db). Is this even technically possible? i.e importing the entire set of events of a channel to my db. Should I fetch all the events of Google/Outlook and import them into my db and then display them in my calendar view. I would like your thoughts on implementing this: If I am doing some change in Google/Outlook calendars it should be visible in my calendar. If I create/edit/update an event in my calendar it should be created/edited/deleted in Google/Outlook calendars. I need to move further from this and need to sync Google and Outlook calendars into my calendar. These events are stored in the db used by application. I have an add/edit form for creating/updating events. I am using FullCalendar in my application to display events created via our own application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |