Protocol VS WebRequest

#1

Hey Community,
I am very new to JS world and sply Electron; and am trying to convert a web app to desktop app. In order to do that, I need to try to intercept requests made by web app inside the sandbox.
Reason for intercept is that I want to provide user an offline experience as well.
This is what i need to do:

  1. Intercept request.
  2. Check if data is present
  3. If data is present send it back
  4. Else, go ahead with service.
  5. When response is received, save (for future) and return it.

I am in fix between Protocol and Web Request. Protocol seems to be the savior here. However, I would be greatful if someone can explain me what is the fundamental difference between them.

Regards,
Kaustav Sarkar

0 Likes