I am trying to subscribe to a nodejs application for modeling sail events. Here is my code:
var socketIOClient = require('socket.io-client'), sailsIOClient = require('sails.io.js'); var io = sailsIOClient(socketIOClient); io.sails.url = 'http://localhost:1337'; io.socket.on("agent", function(event) { console.log(event); }) io.socket.get("/agent", function(resData, jwres) {})
Here is a link to all the output on the sails server when the client (nodejs) connects:
https://gist.github.com/CiscoKidxx/e5af93ebcc24702ba4f8
I understand that when creating a new agent, it should run console.log (event), which lists the changes. This is not happening. I run "now connected to sails" when I run the script. Any thoughts?
Here is my call to create a new agent in my UserController:
Agent.create({ syncToken: token, owner: user.id }).exec(function (err, newAgent) { Agent.publishUpdate(newAgent.id, {syncToken: newAgent.syncToken});
CiscoKidx
source share