Closed dmvt closed 8 years ago
I don't think your problem is with the driver, it's with your I/O, but I'm not sure of anything beyond that.
I removed your monkey-patching of the Driver
code, and added some patched to the socket objects to see what they were receiving:
@socket = TCPSocket.new(@uri.host, 443)
def @socket.write(chunk, *)
p [:tcp_write, chunk]
super
end
@socket = SSLSocket.new(@socket, ssl_context)
def @socket.write(chunk, *)
p [:tls_write, chunk]
super
end
Here's what I see:
I, [2016-02-06T13:08:14.453247 #10930] INFO -- : Celluloid 0.17.3 is running in BACKPORTED mode. [ http://git.io/vJf3J ]
[:tls_write, "GET / HTTP/1.1\r\nHost: ws-feed.exchange.coinbase.com\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: x3W1g/TuwmndkbwEbUZY/g==\r\nSec-WebSocket-Version: 13\r\n\r\n"]
HTTP/1.1 400 Bad Request
Server: cloudflare-nginx
Date: Sat, 06 Feb 2016 13:08:14 GMT
Content-Type: text/html
Content-Length: 275
Connection: close
So the right data is being written to the TLS session but after that I'm not sure what happens.
Thanks for the response. I'll keep diving!
On Saturday, February 6, 2016, James Coglan notifications@github.com wrote:
I don't think your problem is with the driver, it's with your I/O, but I'm not sure of anything beyond that.
I removed your monkey-patching of the Driver code, and added some patched to the socket objects to see what they were receiving:
@socket = TCPSocket.new(@uri.host, 443) def @socket.write(chunk, *) p [:tcp_write, chunk] super end @socket = SSLSocket.new(@socket, ssl_context) def @socket.write(chunk, *) p [:tls_write, chunk] super end
Here's what I see:
I, [2016-02-06T13:08:14.453247 #10930] INFO -- : Celluloid 0.17.3 is running in BACKPORTED mode. [ http://git.io/vJf3J ] [:tls_write, "GET / HTTP/1.1\r\nHost: ws-feed.exchange.coinbase.com\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: x3W1g/TuwmndkbwEbUZY/g==\r\nSec-WebSocket-Version: 13\r\n\r\n"] HTTP/1.1 400 Bad Request Server: cloudflare-nginx Date: Sat, 06 Feb 2016 13:08:14 GMT Content-Type: text/html Content-Length: 275 Connection: close
So the right data is being written to the TLS session but after that I'm not sure what happens.
— Reply to this email directly or view it on GitHub https://github.com/faye/websocket-driver-ruby/issues/37#issuecomment-180763591 .
Dan Matthews
dan@bluefoc.us (802) 578-7987
@dmvt Did you get any further with this issue?
Unfortunately life has been too busy for me to circle back on this yet. I'll close it out and come back to update if / when I get back to it.
I guess the problem is:
@socket = TCPSocket.new(@uri.host, 443)
@socket = SSLSocket.new(@socket, ssl_context)
@socket.connect # needed for SSLSocket
I'll start off by saying I'm not 100% that my issue is with this GEM. I have connected successfully to the websocket using EM & https://github.com/shokai/websocket-client-simple, but would prefer to use a Celluloid based solution.
Here is my implementation:
When I call
ExchangeFeed.run
I get the following response:It seems as though the encryption is being bypassed during the handshake. I've spent a while diving in the source and Google to no avail. Thoughts?