Basic Javascript wrapper for OKCoin & OKEx's WebSocket API.
See index.html for a live working example.
function handleIndex(message) {
// ...
}
function handleDepth(message) {
// ...
}
new OKCoin('wss://real.okex.com:10441/websocket')
.addChannelHandler('ok_sub_futureusd_btc_index', handleIndex)
.addChannelHandler('ok_sub_futureusd_btc_depth_quarter_60', handleDepth)
.start()
jsDelivr can be used to serve a specific version (see tags for version numbers):
<script src="https://cdn.jsdelivr.net/gh/nyg/okcoin-api@x.y.z/okcoin-api.js"></script>
Requires pako.
Doesn't support version 3 of the API.