-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[Node Compat] http.ClientRequest
does not emit upgrade
event (or is buggy)
#17847
Comments
This should probably be transferred over to |
Currently we use So we don't have TcpConn object for that http request. That means even if we implemented 'upgrade' event, it doesn't enable websocket capability on it. I think we probably need to sniff the option object of |
I hope this will be done before 2.0 |
@Jakob5358: It looks like, there will be an attempt to fix the issue soon: #18836 |
Implementation is almost done in #19412 |
Hi,
I tried to figure out how to solve #16899, and discovered that the HTTP client of the
Node Compat
layer does not emit theupgrade
event.This means, that no NPM package that contains a WebSocket client will work properly.
I tried really hard to figure out what's going on, and how to fix it, but I'm not really a Typescript programmer, and the code is hard to follow for me.
It seems, the HTTP client just does not implement the event (it is implemented for the server, however).
The
Event: 'upgrade'
example in the docs of the Node.jshttp
module is a good way to reproduce the issue.You can run it, as follows:
Event: 'upgrade'
example in a fileimport * as http from "https://deno.land/std@0.170.0/node/http.ts";
If you now execute the script, it will just hang. With Node.js, it prints the expected text to the terminal.
Also (because it took me bit to figure this out), here is the easiest way to debug the issue, I've found:
git clone https://github.com/denoland/deno_std
import * as http from '/$PATH_TO/deno_std/node/http.ts'
http
module is atnode/http.ts
The text was updated successfully, but these errors were encountered: