关于python: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 执行相同操作时,您会在第一个请求中获得"过期"日期,因此您知道何时需要续订。

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


推送通知没有真正的超时属性。正如文档中的超时部分所暗示的那样,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.

因此,您不会订阅一定的时间。只要您响应服务器并确认您收到了通知,您就会收到通知。当您停止向每个推送通知发送状态 ping 时,服务器将停止向您发送通知。

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

Webdav101 的关于该主题的文章非常好,他指出,当订阅由于某种原因停止时,由您决定是否有一些后备代码。如果您有一段时间没有收到通知,只需发出新的推送订阅即可解决此问题。