- Source:
Members
events
Get the event handlers for this publisher.
- Source:
events
Set the event handlers for this publisher.
- Source:
loggerName
Get the logger name for this publisher.
- Source:
subscriptionCount
Get the number of subscriptions to this publisher.
- Source:
topic :string
Type:
- string
- Source:
willValidateMessage :boolean
Whether messages will be validated before publishing.
Type:
- boolean
- Source:
willValidateMessage
Enable or disable message validation for this publisher.
- Source:
Methods
assertLiveliness() → {undefined}
Manually assert that this Publisher is alive (for RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC).
- Source:
Returns:
- Type
- undefined
publish(message, optionsopt) → {undefined}
Publish a message
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
message |
object | Buffer | The message to be sent, could be kind of JavaScript message generated from .msg or be a Buffer for a raw message. | |||||||||
options |
object |
<optional> |
Publish options
Properties
|
- Source:
Throws:
-
If validation is enabled and message is invalid
Returns:
- Type
- undefined
setValidation(options)
Set validation options for this publisher.
Parameters:
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | Validation options
Properties
|
- Source:
waitForAllAcked(timeout) → {boolean}
Wait until all published message data is acknowledged or until the specified timeout elapses
If the timeout is negative then this function will block indefinitely until all published
message data is acknowledged.
If the timeout is 0 then it will check if all published message has been acknowledged without
waiting.
If the timeout is greater than 0 then it will return after that period of time has elapsed or
all published message data is acknowledged.
Raises an error if failed, such as the middleware not supporting this feature.
Parameters:
| Name | Type | Description |
|---|---|---|
timeout |
timeout | The duration to wait for all published message data to be acknowledged in nanoseconds. |
- Source:
Returns:
`true` if all published message data is acknowledged before the timeout, otherwise `false`.
- Type
- boolean