Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Is there a way to capture any network requests ? #35

Open
redradist opened this issue Nov 29, 2023 · 6 comments
Open

[Question] Is there a way to capture any network requests ? #35

redradist opened this issue Nov 29, 2023 · 6 comments

Comments

@redradist
Copy link
Contributor

redradist commented Nov 29, 2023

I would like to capture specific network requests to my server that for local application provide a custom response.
In such way I will have less modification in WebApp that I use on local machine

@hassandraga
Copy link
Member

WebUI has webui_set_file_handler() for that.
I believe someone already implemented this API in Deno setFileHandler():

setFileHandler(handler: (url: URL) => string | Uint8Array) {

@redradist
Copy link
Contributor Author

WebUI has webui_set_file_handler() for that. I believe someone already implemented this API in Deno setFileHandler():

setFileHandler(handler: (url: URL) => string | Uint8Array) {

Okay, but will it catch WebSocket requests ? Or HTTP requests ?
I mean, looks like it works only for regular file ...

@redradist
Copy link
Contributor Author

redradist commented Nov 29, 2023

WebUI has webui_set_file_handler() for that. I believe someone already implemented this API in Deno setFileHandler():

setFileHandler(handler: (url: URL) => string | Uint8Array) {

Also it will probably work only for files and HTTP requests, but for WebSocket it won't, because server could respond in anytime and using this API it is not possible to handle

@hassandraga
Copy link
Member

What do you mean with WebSocket requests? The WebUI core WebSocket or your own custom WebSocket?

@hassandraga
Copy link
Member

Yes, setFileHandler only for HTTP requests.

@redradist
Copy link
Contributor Author

What do you mean with WebSocket requests? The WebUI core WebSocket or your own custom WebSocket?

I mean that if my application has WebSocket connection to server and I want to hook it, and instead of server provide responses by myself then setFileHandler will work only in one direction, from WebUI to server, but WwebSocket connection could live for long time and in this case if in future server would like to send some data to client it would not be possible using setFileHandler API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants