Any way to push Javascript from NodeJS server to client for updates?

后端 未结 1 535
小蘑菇
小蘑菇 2021-01-27 11:42

In Scala\'s Liftweb there are some classes which allow for Javascript to be pushed to the browser via comet/ajax after the page has loaded. Some documentation here.

The

相关标签:
1条回答
  • 2021-01-27 12:10

    You can build this functionality into socket.io, either by predefining functions based on dynamic objects that are sent bi-directionally, or by building a system which will parse and run javascript from both sides. Depending on what you are trying to do it might take a while to get that working for you securely (not just throwing everything in eval());

    http://socket.io/

    Alternatively there is a library built on node.js that has this functionality built in. I have not personally used it so I can't attest to the reliability or security of the system, but it should be a good place to start.

    http://www.nowjs.com/
    https://github.com/Flotype/now

    Hope this helps!

    0 讨论(0)
提交回复
热议问题