如何使用市场数据的 Coinbase Websocket 进行适当的握手?

How to do a proper handshake with the Coinbase Websocket for Market Data?

为了正确的 websocket 握手,我应该发送的第一个 HTTP 请求是什么?

我正在发送 GET / HTTP/1.1 和一些其他标准的 websocket headers 但我收到 400 Bad Request。见下文

$ telnet localhost 8889
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
Escape character is '^]'.
GET / HTTP/1.1
Host: ws-feed.exchange.coinbase.com
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: http://www.test.com

HTTP/1.1 400 Bad Request
Server: cloudflare-nginx
Date: Thu, 10 Sep 2015 19:25:54 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=d3fe870c84fc991b0f2f6fc2c936820471441913154; expires=Fri, 09-Sep-16 19:25:54 GMT; path=/; domain=.coinbase.com; HttpOnly
Strict-Transport-Security: max-age=15552000; includeSubDomains; preload
X-Content-Type-Options: nosniff
CF-RAY: 223d857c6bae01ee-EWR

0

Sec-WebSocket-Version header 和 Sec-WebSocket-Key header 缺失。