diff --git a/README.md b/README.md index a956da9..bc386ac 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,15 @@ bittrex.websockets.subscribe(['BTC-ETH','BTC-SC','BTC-ZEN'], function(data, clie }); ``` +#### websockets.unsubscribe +This will close your websocket connection. Please note that by default the websocket client will +try to recoonect so don't forget to set `autoReconnect` to `false`. +```javascript +bittrexApi.options({ websockets: { autoReconnect: false } }); +/... +bittrex.websockets.unsubscribe(); +``` + #### Websocket serviceHandlers example You can override the libraries logic for the following events. Note, this will diff --git a/node.bittrex.api.js b/node.bittrex.api.js index 14bcf0b..b1123c0 100644 --- a/node.bittrex.api.js +++ b/node.bittrex.api.js @@ -321,6 +321,9 @@ var NodeBittrexApi = function() { websocketMarketsCallback = callback; setMessageReceivedWs(); }, force); + }, + unsubscribe: function() { + wsclient.end(); } }, sendCustomRequest: function(request_string, callback, credentials) {