Bittrex WebSocket编码方式是什么?附Chrome模拟连接方法
Bittrex WebSocket Encoding & Connection Simulation Guide
Great question! Let's break this down clearly for you:
1. WebSocket Encoding Method
Bittrex's WebSocket implementation (built on SignalR) uses JSON encoding for message serialization. This is the default format for SignalR communications, so all data exchanged between the client and server will be structured as JSON objects.
2. Simulating the Connection with Chrome DevTools
You're right that this process is straightforward once you know the steps—here's a detailed walkthrough:
- First, send a GET request to retrieve your unique ConnectionToken. You can run this directly in Chrome DevTools' Network tab or Console:
https://socket.bittrex.com/signalr/negotiate?clientProtocol=1.5&connectionData=%5B%7B%22name%22%3A%22c2%22%7D%5D&_=1524596108843 - The response will include a
ConnectionTokenfield (like the example you shared:"gbLsm8C6Jck1mQTTFjmuIv5qgUuMZz/kXU1s+fAnjnW qUFQocNBfp3VOrd/y0acxWL5Fv7MZ54heRddLYZS+EMhLnaPPQiSZblvgJPCbLKqZTIkb"). Copy this token—you’ll need it for the next step. - Finally, initiate the WebSocket connection using a
wssendpoint, replacing the placeholder with your retrieved token. The base connection URL looks like this:
Swapwss://socket.bittrex.com/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=YOUR_TOKEN_HERE&connectionData=%5B%7B%22name%22%3A%22c2%22%7D%5D&tid=7YOUR_TOKEN_HEREwith the token you copied earlier, and you’ll have an active WebSocket connection to Bittrex.
内容的提问来源于stack exchange,提问作者Corey Hart
相关产品推荐
相关产品推荐

