Unsubscribe from webcal

233 Views Asked by At

I want to add a ics link in my website. Users would be able to add this url to their favorite calendar app and see their upcoming events.

My users use my website for a few months and then leave (it's a educational website). So my question is :

Is there a way (in the ics protocol maybe ?) to automatically unsubscribe my users from my ics url to avoid unecessary requests "for life"?

For exemple, iCal on Mac will do a request every hour to the url to get new data. But once a user leave, there will never be new data, so the requests are useless.

Thanks for your help!

1

There are 1 best solutions below

0
anmari On

You can either ask people to unsubscribe, make it desirable perhaps by a dummy daily event that says ' No longer updated, please unsubscribe'

OR

force an unsubscribe by returning an appropriate http return code to the requesting system - probably the 410 (gone) rather than the 404. The 410, as per it's description ,is the most appropriate: "The url is no longer there and the condition is likely to be permanent." https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410

A url could be offered per user. Ensure that it then returns a 410 at end of life (not just an empty file)

The receiving devices don't just quietly unsubscribe the url. Usually they show the error. Ideally the human should unsubscribe. Perhaps an email with quick tips on how to unsubcribe may be best for your situation? at least then you've told them.

I find even for myself I have a lot of garbage calendar urls in my calendar app. If I started getting errors I would unsubscribe them (or if there was garbage events, I might unsubscribe or 'hide' it.

Other ways of conveying information to the requesting app, that may reduce load on your server:

Last Modified in the header https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After (No 'never'!)

There are also unofficial (non RFC5545) extensions that you could include in the ics file: eg: X-PUBLISHED-TTL - Recommended update interval for subscription to the calendar. One could make that a really long interval. See https://en.wikipedia.org/wiki/ICalendar#Calendar_extensions