# MessageOptions

**Kind**: interface | **Module**: [Pub Sub](https://docs.interop.io/desktop/reference/javascript/pub%20sub/index.md)

**Source**: https://docs.interop.io/desktop/reference/javascript/pub sub/messageoptions/index.html

If `routingKey` is provided when publishing a message, the message will be delivered only to peers that have provided the same routing key
or no routing key during subscription.
If `routingKey` is provided when subscribing for a topic, only messages that have been published with a matching routing key or no routing key
at all will be received by the subscriber.
If `target` is provided when publishing a message, the message will be delivered only to subscribers for which all properties of the target object
match the respective fields on the subscribers identity.
If `target` is provided when subscribing for a topic, the provided object will be compared to the identity of the publishers of the messages
and only if they match will the messages be received by the subscriber.

## Properties

- **`routingKey`** (`string`, optional)
  Routing key specified by the publisher/subscriber.
- **`target`** (`object`, optional)
  Target specified by the publisher/subscriber.
