Victor Castro
Victor Castro

Reputation: 1242

Be notified when replayed request has a response

I try to be notified with no success (using an eventListner, a Callback or anything else) when a request replayed by BackgroundSync.Queue "DidReplay" (only the request, not the entire queue).

The point is that I need to get the server response to alter the incoming replaying requests in requestWillReplay depending of this response.

Also, I tried to intercept the request using:

self.addEventListener('fetch', (event) => {...})

but it doesn't work, I only intercept requests from the client.

Is there any way to do it ?

Upvotes: 0

Views: 94

Answers (1)

Jeff Posnick
Jeff Posnick

Reputation: 56134

You seem to already be familiar with using workbox.backgroundSync.Queue's callbacks.requestWillReplay() to modify the request prior to it being retried. That's the only callback that's currently supported.

If you're asking for more functionality beyond that, your best bet is to file a feature request against Workbox with the specific requirements.

Upvotes: 1

Related Questions