Closed laurent-martin closed 1 year ago
@laurent-martin Thank you for pointing this out.
As far as I know, it is because the original author (shokai) implemented it that way.
I am a maintainer. So I do not want to make any significant changes to the current code base. Fortunately, the core of this library is only about 100 lines long. If you want the ability to proxy, it should not be too difficult to modify this library.
Thanks,
no problem,
Since the core of the work is in the websocket gem... I now use that lib directly, and dropped websocket-client-simple , but that was useful to speedup at the beginning.
the new code is more embedded in the app here: https://github.com/IBM/aspera-cli/blob/develop/lib/aspera/fasp/agent_httpgw.rb#L78
The idea is:
http_socket = Net::HTTP.start(...)
# this is the BufferedIO equivalent to a socket
ws_io = http_socket.instance_variable_get(:@socket)
# and then it is similar to this gem, using ::WebSocket::Handshake
# and to finalize:
http_socket&.finish
The advantage of that is that if the user specifies a proxy in Net::HTTP.start, then the websocket is forwarded through the proxy...
Thanks,
no problem,
Since the core of the work is in the websocket gem... I now use that lib directly, and dropped websocket-client-simple , but that was useful to speedup at the beginning.
the new code is more embedded in the app here: https://github.com/IBM/aspera-cli/blob/develop/lib/aspera/fasp/agent_httpgw.rb#L78
The idea is:
http_socket = Net::HTTP.start(...) # this is the BufferedIO equivalent to a socket ws_io = http_socket.instance_variable_get(:@socket) # and then it is similar to this gem, using ::WebSocket::Handshake # and to finalize: http_socket&.finish
The advantage of that is that if the user specifies a proxy in Net::HTTP.start, then the websocket is forwarded through the proxy...
Hi @laurent-martin The link you provided gives 404, Could you provide more detailed steps to make the websocket-client-simple proxy supported? I am using websocket-client-simple in my Gem and have similar requirement to make it capable of using the proxy.
Hi,
Nice simple web socket client, easy to use.
Still, I am missing something: possibility to go through a forward http proxy.
Since the implementation uses a TCPsocket, then it does not honour the
http_proxy
env var, so the ruby http library way of handling proxies...Maybe someone has this in the pocket ?
I wonder if it would be possible that the oimplementation uses Ruby's HTTP object (with connect, etc...) instead of raw TCPSocket...