curl-impersonate
curl-impersonate copied to clipboard
Does this project provide a solution for connecting to a web socket?
Does this project provide a solution for connecting to a web socket? For example, I need an example like this in nodejs:
var socket = new WebSocket(url);
socket.onopen = function() {
...
};
socket.onmessage = function(e) {
...
};
The url
in that example is on cloudflare.
Unfortunately it seems that curl doesn't implement websockets yet even though it's a highly requested feature: See here https://github.com/curl/curl/wiki/WebSockets
You can send the initial HTTP request with the 'Upgrade: websocket' header using curl but if you want to receive or send messages I think you are out of luck.
To make this work it should probably be a separate project, possibly modifying Node or another Websocket implementation to behave like curl-impersonate when opening TLS connections.
Don't mean to jump the gun too hard (it's been only ~two weeks since it was released), but I've noticed that curl 7.86.0 has shipped with experimental websocket support, so just wanted to check whether it's something on your radar?
I was aware of the work being done but wasn't aware that it already landed in a release. These are good news! I would definitely attempt to upgrade to 7.86. It would be interesting to see if the impersonation works for websockets easily.
Interested if you guys are thinking about implementing this :)
Now that curl has websocket support, I'm attempting to implement it as part of #160