Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

call node js function from javascript

<script src="/socket.io/socket.io.js"></script>
<script>
  var socket = io.connect('http://localhost'); // connec to server
  socket.on('news', function (data) { // listen to news event raised by the server
    console.log(data);
    socket.emit('my other event', { my: 'data' }); // raise an event on the server
  });
</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #call #node #js #function #javascript
ADD COMMENT
Topic
Name
7+6 =