GoogleNotificationHandler is a shared singleton HTTP handler for incoming Google push notifications. It is registered as a 4D HTTP handler at the /4dnk-google-notification route, and routes incoming webhook requests to the appropriate active GoogleNotification monitor.
To use push mode with the host web server, add the following entry to Project/Sources/HTTPHandlers.json:
[
{
"class": "NetKit.GoogleNotificationHandler",
"method": "getResponse",
"regexPattern": "/4dnk-google-notification",
"verbs": "post"
}
]
If the OAuth 2.0 connection uses an HTTPS redirect URI, the port in the
endPointmust match exactly. If both acalendar.notifierand amail.notifierare declared, they must use the same port.
.getResponse( request : 4D.IncomingMessage ) : 4D.OutgoingMessage
| Parameter | Type | Description | |
|---|---|---|---|
| request | 4D.IncomingMessage | -> | Incoming HTTP request from Google. |
| Result | 4D.OutgoingMessage | <- | HTTP 200 response on success; HTTP 400 when request is Null. |
.getResponse() handles two types of incoming push notifications:
X-Goog-Channel-Token header; routed to the calendar notification processor.message.data (base64 encoded); routed to the Gmail notification processor.The handler dispatches the corresponding callbacks (onCreate, onDelete, onModify) defined in the active GoogleNotification monitors via Storage.googleNotifications.