-
Notifications
You must be signed in to change notification settings - Fork 23
addFilter
Jim Cowart edited this page Jan 16, 2013
·
1 revision
The method used to add filters to constrain which messages should be sent or received to/from other remote instances of postal.
Where the filter
argument is an object literal containing channel
, topic
and direction
. For example:
// if the filter mode is `whitelist`, then the below call is adding a filter
// to allow any message matching the channel "data" and the topic wildcard
// of "#" to be sent out to remote instances
postal.fedx.addFilter({ channel: 'data', topic: '#', direction: 'out' });
// if the filter mode is `whitelist`, then the below call is adding a filter
// to allow and "data" channel messages matching a topic of "request.*.read"
// to be received from remote instances of postal
postal.fedx.addFilter({ channel: 'data', topic: 'request.*.read', direction: 'in' });
// if the filter mode is `blacklist`, then the below call is adding a filter
// to prevent ANY messages on the "postal" channel from being sent or received
// to/from remote instances of postal.
postal.fedx.addFilter({ channel: 'postal', topic: '#' }); // direction defaults to "both"
This override allows you to provide an array of filters, like this:
postal.fedx.addFilter([
{ channel: 'data', topic: '#', direction: 'out' },
{ channel: 'data', topic: 'request.*.read', direction: 'in' },
{ channel: 'postal', topic: '#' }
]);