EWS 推送订阅,如何知道什么时候到期?

EWS Push Subscription, how to know when it expires?

我正在使用 python 订阅日历事件的 EWS 推送通知。 https://msdn.microsoft.com/en-us/library/office/dd636171(v=exchg.80).aspx

当对 google 做同样的事情时,您会在第一个请求中得到一个 "expires" 日期,这样您就知道何时需要续订。

我如何知道 EWS 订阅何时到期以便我可以续订?

推送通知没有真正的超时 属性。正如 time-out section in the documentation:

所暗示的那样,Exchange 推送通知的工作方式略有不同

If the server does not receive a response to a push notification or status ping, it retries sending the notification several times before it stops sending the notifications.

所以您没有订阅一定的时间。只要您响应服务器并确认您收到了通知,您就会收到通知。当您停止向每个推送通知发送 status pings 时,服务器将停止向您发送通知。

Exchange 服务器应该重试多少次并要求您提供 status ping 可以在初始订阅请求中使用 StatusFrequency 元素指定。您只需指定服务器在放弃和停止向您推送通知之前要求您确认的时间。

Webdav101's article on the topic 非常好,他说当订阅因某种原因停止时,您可以使用一些后备代码。如果您有一段时间没有收到通知,只需发布​​一个新的推送订阅就可以解决这个问题。