Anyone have experinace with seneca?
I have problem when I try to inclue mesh...
This is hapi route:
server.route({
method: 'GET',
path: '/api/ping',
handler: function (req, reply) {
server.seneca// load the mesh plugin
.use('mesh')
// send a message out into the network
// the network will know where to send format:hex messages
.act('foo:1,v:2', (err: any, out: any) => {
console.log(err)
// prints #FF0000
reply(null, out)
})
}
})
And this is my service:
require('seneca')({
})
//.use('zipkin-tracer', {sampling:1})
.use('entity')
.use('ping-logic')
.ready(function(){
console.log(this.id)
})
logic:
module.exports = function post(options) {
var seneca = this
seneca// provide an action for the format:hex pattern
.add( 'foo:1', function (msg, done) {
done( null, {x:1,v:100+msg.v} )
})
.use('mesh', { auto:true, pin:'foo:1' })
}
I get error
CL MISSING { foo: 1, v: 2 }
Anyone know what is porblem?
I have bumped into this, too. There were two things I had to do:
Add seneca.ready(function ()) in your hapi route like this:
Also check this related github issue in which I asked the main contributor if there is a plan to have a new fixed version soon on NPM: https://github.com/senecajs/seneca-mesh/issues/90
Hope this helps