Home > @imqueue/rpc > IMessageQueue > publish
IMessageQueue.publish() method
Publishes data to the current queue channel
If toName is specified, publishes to a pubsub with a different name. This can be used to broadcast messages to other subscribers on different pubsub channels. Different names must be in the same namespace (same imq prefix).
Signature:
publish(data: JsonObject, toName?: string): Promise<void>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
data |
data to publish as a channel message | |
|
toName |
string |
(Optional) optional different pubsub name to publish to |
Returns:
Promise<void>
{Promise