This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

msg-fabric-endpoint

0.5.17 • Public • Published

msg-fabric-endpoint

Endpoint plugin for msg-fabric-core

Examples

Creating a new hub with endpoint plugin
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)
  } })
 
Creating a new hub with endpoint plugin (JSY dialect)
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)
 

License

2-Clause BSD

Package Sidebar

Install

npm i msg-fabric-endpoint

Weekly Downloads

4

Version

0.5.17

License

BSD-2-Clause

Unpacked Size

179 kB

Total Files

7

Last publish

Collaborators

  • shanewholloway