Skip to content

Instantly share code, notes, and snippets.

@acidtib
Created April 25, 2017 19:15
Show Gist options
  • Save acidtib/7ff6778e588b510f1004aaddaa0ed0d7 to your computer and use it in GitHub Desktop.
Save acidtib/7ff6778e588b510f1004aaddaa0ed0d7 to your computer and use it in GitHub Desktop.
Unexpected end of http request (Exception)
0x107ab5fc5: *CallStack::unwind:Array(Pointer(Void)) at ??
0x107ab5f61: *CallStack#initialize:Array(Pointer(Void)) at ??
0x107ab5f38: *CallStack::new:CallStack at ??
0x107a9c251: *raise<Exception>:NoReturn at ??
0x107a9c231: *raise<String>:NoReturn at ??
0x107be72cf: *HTTP::Client::Response::from_io<(OpenSSL::SSL::Socket::Client | TCPSocket), Bool, Bool>:HTTP::Client::Response at ??
0x107be7279: *HTTP::Client::Response::from_io<(OpenSSL::SSL::Socket::Client | TCPSocket)>:HTTP::Client::Response at ??
0x107b900d1: *HTTP::WebSocket::Protocol::new<String, String, (Int32 | Nil), Bool>:HTTP::WebSocket::Protocol at ??
0x107b8fcd0: *HTTP::WebSocket::Protocol::new<URI>:HTTP::WebSocket::Protocol at ??
0x107bd6489: *HTTP::WebSocket::new<URI>:HTTP::WebSocket at ??
0x107a9bb57: __crystal_main at ??
0x107aad198: main at ??
make: *** [run] Error 1
payload = {"type" => "subscribe", "product_ids" => ["BTC-USD"]}.to_json
ws = HTTP::WebSocket.new(URI.parse("wss://ws-feed.gdax.com"))
ws.on_message do |msg|
msg = JSON.parse(msg).as_h
puts msg
end
ws.send(payload)
ws.on_close do |msg|
msg = JSON.parse(msg).as_h
puts msg
end
ws.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment