You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we use an event 'push' internally to update http2-cache Configuration.cache to last response and app need to perform new XHR to get updated content from cache.
I know that the clean way would be to shim SSE on http2-cache.js but that would required developer to change from XHR to SSE on their application also.
That why this issue is more for addressing the issue in term of XHR use case.
Note: the future way would be to have a http2-cache.js in pair with ServiceWorker and use push event
Note2: Another alternative would be to implement Fetch and Stream
fetch("https://www.example.org/").then((response) => {
const reader = response.body.getReader();
const stream = new ReadableStream({
start(controller) {
// The following function handles each data chunk
function push() {
// "done" is a Boolean and value a "Uint8Array"
reader.read().then(({ done, value }) => {
// Is there no more data to read?
if (done) {
// Tell the browser that we have finished sending data
controller.close();
return;
}
// Get the data and send it to the browser via the controller
controller.enqueue(value);
push();
});
};
push();
}
});
return new Response(stream, { headers: { "Content-Type": "text/html" } });
});
Currently we use an event 'push' internally to update http2-cache Configuration.cache to last response and app need to perform new XHR to get updated content from cache.
I know that the
clean
way would be to shim SSE on http2-cache.js but that would required developer to change from XHR to SSE on their application also.That why this issue is more for addressing the issue in term of XHR use case.
Note: the future way would be to have a http2-cache.js in pair with ServiceWorker and use push event
Note2: Another alternative would be to implement
Fetch
andStream
Note3: SSE ref https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
The text was updated successfully, but these errors were encountered: