# Is it possible to refer external libraries (CDN) in function node

**URL:** <https://discourse.nodered.org/t/is-it-possible-to-refer-external-libraries-cdn-in-function-node/34242>\
**Category:** General\
**Created:** [14 October 2020 13:01 UTC](https://discourse.nodered.org/t/is-it-possible-to-refer-external-libraries-cdn-in-function-node/34242 "2020-10-14T13:01:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![codecracker2020](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/codecracker2020/32/37449_2.png) [@codecracker2020](https://discourse.nodered.org/u/codecracker2020)\
**Post date:** [14 October 2020 13:01 UTC](https://discourse.nodered.org/t/is-it-possible-to-refer-external-libraries-cdn-in-function-node/34242/1 "2020-10-14T13:01:17Z")

</div>

Is it possible to refer external libraries (CDN) in function node?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 October 2020 13:36 UTC](https://discourse.nodered.org/t/is-it-possible-to-refer-external-libraries-cdn-in-function-node/34242/2 "2020-10-14T13:36:39Z")

</div>

Not certain how you would achieve that but there is the NPM node that downloads package from NPM and uses `require` syntax in a function node.

However, that said, there are many pre-made nodes. What in particular do you want to do that makes you think you need to get code/lib from a CDN / external source?

---

<div class="post-metadata">

**Author:** ![codecracker2020](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/codecracker2020/32/37449_2.png) [@codecracker2020](https://discourse.nodered.org/u/codecracker2020)\
**Post date:** [15 October 2020 04:59 UTC](https://discourse.nodered.org/t/is-it-possible-to-refer-external-libraries-cdn-in-function-node/34242/3 "2020-10-15T04:59:53Z")

</div>

As per my business logic, i need to connect to a wss protocol and should subscribe to topics (not mqtt, only websockets). I am able to connect to the websocket url but dont know how to subscribe to the topics.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 October 2020 06:17 UTC](https://discourse.nodered.org/t/is-it-possible-to-refer-external-libraries-cdn-in-function-node/34242/4 "2020-10-15T06:17:01Z")

</div>

That sounds like some custom application logic over web socket. Topics are not really "a thing" inherent to web sockets. I don't see any reason you couldn't use the built in web socket node. Do you have protocol details & API details for this connection?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 December 2020 06:17 UTC](https://discourse.nodered.org/t/is-it-possible-to-refer-external-libraries-cdn-in-function-node/34242/5 "2020-12-14T06:17:16Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
