Best way to embed a real time widget using node.js

So, i'm developing with node.js and express a webapp where people create a "widget" that they can embed in their articles. I use socket.io to deliver the users the content.

Using express I was printing an .html file where there were javascript parameters, stylesheets, socket.io connect, etc

I pass, via socket.io, back to the server an id so I could know which widget it was and then run the stuff in the backend.

The problem is: while using this static .html and using socket.io I can't see how could I allow the embeddable feature, you know, just use all the parameters and javascript and stuff in an ordinary page doesn't work because it is not connected to the server as my index.html is.

As a begginer with node.js I might be missing something.

Hope you can help me. Thanks!