Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 1.07 KB

router_fabric.md

File metadata and controls

31 lines (21 loc) · 1.07 KB

MsgFabric Fabric Router reference

hub.router

Properties

  • timeouts -- returns shared timer. See timeouts docs
  • loopback -- MessagePort based local channel. See code/channel.jsy
  • router_ctx -- Shared context for target packets. Extensible by plugins.

Methods

  • addDynamic(id_route, route : function, opt) : [route, bound removeRoute] alias for addPeer() or addRoute() depending on route argument.

  • addPeer(id_route, channel, opt) : [route, bound removeRoute] composed addRoute()

  • addRoute(id_route, route : function, opt) : {route : function, cancel: bound removeRoute}

  • removeRoute(id_route) : Boolean or removeRoute({id_route}) : Boolean

  • hasRoute(id_route) : Boolean

  • getRoute(id_route) : route function

  • dispatch(pkt, channel) : Promise

  • resolveRoute(id_route, allowDiscover, allowUpstream) : route function

  • publishRoute(route)

  • setUpstream(upstream, opt)

  • discoverRoute() -- see plugins/discover

  • ref() and unref()