wulfey
Connect to a WebSocket through a HTTP(S)/SOCKS5 proxy
Title - I am trying to connect to a
wss://
websocket through a proxy of choice at runtime.
Is there a way to do this alike to Deno.createHttpClient
for regular requests?
If not (and I would say it is in fact more complicated), what should I do to achieve this?2 replies
Proper usage of `Deno.HttpClient`
Hi! I'm creating an application which allows the internal use of HTTP proxies for certain tasks.
In that case,
fetch()
requests are given an instance of Deno.HttpClient
per proxy, but for multiple fetch()
calls, if they're supposed to use the same proxy, the same HttpClient
instance is used.
This is something I am curious about, should I create a new HttpClient
for every executed fetch()
, or is it fine to reuse the same HttpClients
for multiple requests?2 replies
Preventing `Deno.stdin` reads from blocking
In a module for reading
Deno.stdin
input, there is a loop that reads and parses the returned bytes.
My issue is that, in case of an uncaught error/rejection, the process hangs until stdin
has something to return, and once it does, only then does it exit the process and log the error information.
Is there a way to make this read()
non-blocking in that sense?
If the user does not input anything, but an error occurs, the process should exit immediately and not have to wait for a keypress.
The code below can be run from a file for demonstration.
12 replies
Properly continuously read data from a Reader
What's the proper way to continuously read from a
Deno.Reader
?
I'm trying to parse incoming HTTP2 frames from a Deno.TlsConn
, but my current method of reading involves two sets of while
loops, one to continuously perform the read operation, and the other, to try read everything currently available to read from the stream in chunks of 16k.
Naturally, the while
loops make it take approximately one entire core of my processor, which is far from ideal.
Can this in any way be improved? Is there a way to know (wait for a promise to resolve or such) when there is available data?40 replies
Is there a way to fetch() with headers, WITHOUT forcing header keys to lowercase?
Title. I'm trying to create an API wrapper for a service which uses "Incapsula" as their firewall or something like that.
Issue is, when making a
fetch()
request through Deno, the request gets blocked, with the exact same required header and parameter structure as done through say a web browser (simple GET) or an API testing app.
I noticed that the flushed HTTP headers are forced lowercase (which is good, in most cases), which I feel like is causing issues with this very specific API (specifically, only my Deno requests are blocked).
Any way to flush headers as-is? (Or is a custom request/fetch library required for this)16 replies