This project will make it so erureca.io server can be integrated with Sails
Sails hook to integrate eureca.io
This library is not to replace sails.io that is built in, but to supplement the capabilities of realtime communications and control using eureca.io.
config/eureca.js
module.exports = {
prefix: 'eureca.io',
onConnect: function (context) {
},
onDisconnect: function (context) {
},
onMessage: function (msg) {
},
onError: function (err) {
}
}
Each module that is in the api/eureca folder will be exported on the EurecaServer instances exports object.
The below example demonstrates how to provide access to the Sample model's find method.
api/eureca/Sample.js
module.exports = {
//Tell the eureca.io client context that it will be using
//and asyncronous call that will trigger the onReady or then
//when the context.return method is called.
find : function(query){
var context = this;
context.async = true;
Sample.find(query).then(function(data){
context.return(data);
},
function(err){
context.return(err);
});
}
}
please feel free to open up any issue on GitHub to drop in a suggestion or something.