Can we do this with tcp connect?

Currently, I have to have a nodejs server that makes this connection, and I use cloudflare to proxy my websocket to this machine. It'd be ideal if Icould make this connection directly from inside cloudflare workers, but I do see the ability to set the servername and alpn protocols. const targetTCPSocket = tls.connect({ host: 'url', port: 443, rejectUnauthorized: true, // Enable certificate validation ALPNProtocols: ['h2', 'http/1.1'], minVersion: 'TLSv1.3', maxVersion: 'TLSv1.3', servername: 'url', });
1 Reply
Walshy
Walshy4mo ago
TCP is meant for TCP not HTTP. fetch is there for that. To do HTTP over TCP sockets, you'd need to fully manage that yourself (which for h/1.1 is easy). Any reason you can't just fetch the websocket?
Want results from more Discord servers?
Add your server