@baris
I understand that and have accomplished it via doing it server side in websockets.js . My problem occurs when trying to do it from a plugin. My plugin looks as such and errors on the socket.on line;
var fs = require('fs'),
path = require('path'),
canIrestart =
init: function() {
/*socket.on("api:testrestart", function testrestart() {
winston.info('[testrestart] Testing socket.on');
});*/
},
admin: {
menu: function(custom_header, callback) {
custom_header.plugins.push({
"route": '/plugins/canIrestart',
"icon": 'icon-edit',
"name": 'canIrestart'
});
return custom_header;
},
route: function(custom_routes, callback) {
fs.readFile(path.join(__dirname, 'public/templates/admin.tpl'), function(err, tpl) {
custom_routes.routes.push({
route: '/plugins/canIrestart',
method: "get",
options: function(req, res, callback) {
callback({
req: req,
res: res,
route: '/plugins/canIrestart',
name: canIrestart,
content: tpl
});
}
});
callback(null, custom_routes);
});
},
activate: function(id) {
}
}
socket.on('yourEventName', function(data, callback) {
console.log('client said', data);
callback();
}
};
canIrestart.init();
module.exports = canIrestart;