Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

call node js function from javascript

var io = require('socket.io').listen(80); // initiate socket.io server

io.sockets.on('connection', function (socket) {
  socket.emit('news', { hello: 'world' }); // Send data to client

  // wait for the event raised by the client
  socket.on('my other event', function (data) {  
    console.log(data);
  });
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #call #node #js #function #javascript
ADD COMMENT
Topic
Name
8+8 =