Changing Websocket url, how to deal with it?

Hello,

I'm using a websocket that changes it's URL frequently, is it possible to workaround this (for example pass options via a msg to configure the URL?).

Currently I'm using: https://flows.nodered.org/node/node-red-contrib-function-npm and manually implementing ws via 'require', but this isn't flexible as once a websocket connection is opened, I can't seem to close it, even by redeploying the function node (I guess it runs as another process in the background!).

Can anyone suggest a viable workaround?

I would begin looking at the source. Websockets exist for interaction and should be available at a single endpoint.

Sadly, the endpoint does change (like one of IBM's own Watson endpoints!).

Further, at times I find myself needing to dynamically create endpoint URL's due to changing product options, I was hoping there was a way I could automate endpoint changes...

I've located the code for the websocket node here:

I just need to work out how to add an option whereby the url can be set via a msg...

Sadly, the endpoint does change (like one of IBM's own Watson endpoints!).

these are static according to their documentation.