Im trying to close a websocket from an npm package that connects to a third party service.
I instantiate the ws by doing:
ws = BitMexPlus({
apiKeyID: rows[i].bot_key.apiKeyID,
apiKeySecret: rows[i].bot_key.apiKeySecret
})
This then calls another np package within it and makes the connection to the 3rd party.
How ever I want to be able to close the ws at will so naturally I do:
ws.close()
but I get the error:
ws.close is not a function
how ever for error handling and proper logging I do:
ws.on('end', async (code) => {console.log(code)})
and this works flawlessly.
Keep in mind the code dealing with this error handling is buried all the way inside the second package. So technically I should be able to close it with the ws instantiation.
How should I be calling the endpoint to close it?