Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to change sync frequency? #81

Closed
naneri opened this issue Jan 10, 2017 · 12 comments
Closed

Is there a way to change sync frequency? #81

naneri opened this issue Jan 10, 2017 · 12 comments

Comments

@naneri
Copy link

naneri commented Jan 10, 2017

I have imported the cal generated by this package to outlook and it says that it will sync once in 168 hours, due to the limit set by the calendar provider. Is there a way to change this ?

@markuspoerschke
Copy link
Owner

Hey @naneri,

I am not aware of any restriction that can be set in .ics files to prevent the client to update. Maybe you can show more of your problem? How does your generated .ics file look like? How does the code look like that generates the file?

@naneri
Copy link
Author

naneri commented Jan 10, 2017

    public function generateIcal($user_id)
    {
        $vCalendar = new Calendar(config('app.url'));

        $plans = MealPlan::where('user_id', $user_id)->get();

        foreach($plans as $plan){
            $vEvent = new Event();

            $vEvent
                ->setDtStart(new \DateTime($plan->date))
                ->setDtEnd(new \DateTime($plan->date))
                ->setNoTime(true)
                ->setSummary($plan->type);

            $vCalendar->addComponent($vEvent);
        }

        return response($vCalendar->render())
            ->withHeaders([
                'Content-Type'          => 'text/calendar; charset=utf-8',
                'Content-Disposition'   => 'attachment; filename="cal.ics"'
            ]);
    }

Here is the code.

@naneri
Copy link
Author

naneri commented Jan 10, 2017

BEGIN:VCALENDAR
VERSION:2.0
PRODID:http://anya.dev
X-PUBLISHED-TTL:P1W
BEGIN:VEVENT
UID:58748a622bdc4
DTSTART;VALUE=DATE:20161229
SEQUENCE:0
TRANSP:OPAQUE
DTEND;VALUE=DATE:20161229
SUMMARY:breakfast
CLASS:PUBLIC
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
DTSTAMP:20170110T131650Z
END:VEVENT
BEGIN:VEVENT
UID:58748a622bdc4
DTSTART;VALUE=DATE:20161229
SEQUENCE:0
TRANSP:OPAQUE
DTEND;VALUE=DATE:20161229
SUMMARY:breakfast
CLASS:PUBLIC
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
DTSTAMP:20170110T131650Z
END:VEVENT
BEGIN:VEVENT
UID:58748a622bdc4
DTSTART;VALUE=DATE:20161230
SEQUENCE:0
TRANSP:OPAQUE
DTEND;VALUE=DATE:20161230
SUMMARY:breakfast
CLASS:PUBLIC
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
DTSTAMP:20170110T131650Z
END:VEVENT
BEGIN:VEVENT
UID:58748a622bdc4
DTSTART;VALUE=DATE:20161230
SEQUENCE:0
TRANSP:OPAQUE
DTEND;VALUE=DATE:20161230
SUMMARY:breakfast
CLASS:PUBLIC
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
DTSTAMP:20170110T131650Z
END:VEVENT
BEGIN:VEVENT
UID:58748a622bdc4
DTSTART;VALUE=DATE:20170104
SEQUENCE:0
TRANSP:OPAQUE
DTEND;VALUE=DATE:20170104
SUMMARY:lunch
CLASS:PUBLIC
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
DTSTAMP:20170110T131650Z
END:VEVENT
BEGIN:VEVENT
UID:58748a622bdc4
DTSTART;VALUE=DATE:20170104
SEQUENCE:0
TRANSP:OPAQUE
DTEND;VALUE=DATE:20170104
SUMMARY:snacks
CLASS:PUBLIC
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
DTSTAMP:20170110T131650Z
END:VEVENT
BEGIN:VEVENT
UID:58748a622bdc4
DTSTART;VALUE=DATE:20170105
SEQUENCE:0
TRANSP:OPAQUE
DTEND;VALUE=DATE:20170105
SUMMARY:breakfast
CLASS:PUBLIC
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
DTSTAMP:20170110T131650Z
END:VEVENT
BEGIN:VEVENT
UID:58748a622bdc4
DTSTART;VALUE=DATE:20170109
SEQUENCE:0
TRANSP:OPAQUE
DTEND;VALUE=DATE:20170109
SUMMARY:snacks
CLASS:PUBLIC
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
DTSTAMP:20170110T131650Z
END:VEVENT
BEGIN:VEVENT
UID:58748a622bdc4
DTSTART;VALUE=DATE:20170107
SEQUENCE:0
TRANSP:OPAQUE
DTEND;VALUE=DATE:20170107
SUMMARY:breakfast
CLASS:PUBLIC
X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
DTSTAMP:20170110T131650Z
END:VEVENT
END:VCALENDAR

@markuspoerschke
Copy link
Owner

In the generated .ics file I cannot see anything that will prevent the consumer/client to update the information from that file. Normally caching would be the concern of a different layer. Normally the iCal files are transferred using HTTP. Any rule for caching etc. could be made there.

One thing that looks wrong in the generated is that the events have the same UID instead having their own UID that must differ from all others. (I will have a look into that later but this might not be your actual problem here.)

Which version of Outlook are you using? Did you already search for the message and how to avoid it?

@markuspoerschke
Copy link
Owner

As a conclusion: to me this problem looks like a problem fro the client rather than from the generated .ics file. You could also try another client instead of Outlook to verify that.

@naneri
Copy link
Author

naneri commented Jan 17, 2017

@markuspoerschke it seems that the problem is with Microsoft Outlook, it thinks that all .ics set update rate to 168 hours, by default, and for instance on Mac you can sync the events manually or with much higher frequence (like every five minutes at least).

@markuspoerschke
Copy link
Owner

@naneri Can I close this issue then?

@jrjohnson
Copy link
Contributor

I would guess it is respecting X-PUBLISHED-TTL:P1W 1 Week being 168 hours. You can change that with $vCalendar->setPublishedTTL('P1H'); (changes it to one hour).

@markuspoerschke
Copy link
Owner

I was really not ready this issue carefully enough.

@jrjohnson Do you have expirience with this property? Do you think the default value of 1 week makes sense? Maybe it is better to drop the default and make it optional?

@markuspoerschke markuspoerschke added this to the Version 0.12.0 milestone Apr 24, 2017
@jrjohnson
Copy link
Contributor

I've personally always set it at one hour - but that makes the most sense for our use case. I would see removing the default as a breaking change for anyone relying on it - but other than that I only have our own usage to compare it to.

@markuspoerschke
Copy link
Owner

I removed the default value for X-PUBLISHED-TTL. This library is for creating .ics as well as for creating endpoints providing icalendar data for sync. I think the value isn’t needed as default for the most people and it can be setted very easily. The absent of this value is at least not hindering the clients from updating as often as they want.

The unpublished version 0.12 contains breaking changes anyways like the PHP version constraint.

@dontliem1
Copy link

RFC 7986 introduced a REFRESH-INTERVAL property:

https://www.rfc-editor.org/rfc/rfc7986#section-5.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants