What is the right way to handle huge payload size in webhooks?

1.5k Views Asked by At

We are trying to write a webhook where we notify the subscribers details about all their resources if one or more resource becomes 'inactive'.

Since, different subscribers can have different number of resources, the payload size of webhook POST request to a URL will vary.

Sample payload -

{ "id1": "inactive", "id2": "inactive", "id5": "inactive" ... }

There is no limit to the amount of resources a subscriber can own, so it can be as high as 50,000 or more.

As the payload can be higher in certain cases, problem which arises are-

  1. Producer of the webhook can take time if payload size is high
  2. Consumer (endpoint) receiving the webhook may not be able to accept such high payload

Some input on the following will be helpful:

  1. How to handle such situation? What is the right limit of payload which can be allowed via webhook like say 5MB? Github defines a maximum cap of 25MB for webhooks. How to come up with such a number?
  2. What happens if payload limit is breached?
  3. Skinny Payload can be used here? Like a global status indicating everything is alright or not, using which users can do a PULL (GET request) to get the entire set of data. But here, users will need to receive the webhook and then again do one more request if things are not alright. [Ref: http://resthooks.org/docs/performance/]

PS: Please pardon me if this isn't the right way I'm asking this question. Using stack overflow after long.

0

There are 0 best solutions below