DEPRECATED
Endpoint plugin for msg-fabric-core
import FabricHubBase from 'msg-fabric-core'
import pi_endpoint from 'msg-fabric-endpoint'
const FabricHub = FabricHubBase.plugins( pi_endpoint() )
const hub = FabricHub.create()
const ep_addr_1 = await hub.endpoint({
on_init(ep, hub) {
console.log('on endpoint init')
},
on_ready(ep, hub) {
console.log('on endpoint ready')
},
on_msg({msg, pkt, reply, anon, ep, hub}) {
console.log('on endpoint message', msg, pkt)
},
})
// ... or ...
const ep_addr_2 = await hub.endpoint( (ep, hub) => {
console.log('on endpoint init')
return ({msg, pkt, reply, anon}) => {
console.log('on endpoint message', msg, pkt)
} })
import FabricHubBase from 'msg-fabric-core'
import pi_endpoint from 'msg-fabric-endpoint'
const FabricHub = FabricHubBase.plugins( pi_endpoint() )
const hub = FabricHub.create()
const ep_addr_1 = await hub.endpoint @:
on_init(ep, hub) ::
console.log('on endpoint init')
on_ready(ep, hub) ::
console.log('on endpoint ready')
on_msg({msg, pkt, reply, anon, ep, hub}) ::
console.log('on endpoint message', msg, pkt)
// ... or ...
const ep_addr_2 = await hub.endpoint @ (ep, hub) => ::
console.log('on endpoint init')
return ({msg, pkt, reply, anon}) => ::
console.log('on endpoint message', msg, pkt)