diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 340c2968cb6fb0..4fe41346b797f7 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -459,6 +459,21 @@ if (cluster.isMaster) { } ``` +The optional `callback` is a function that is invoked after the message is +sent but before the worker or master may have received it. +The function is called with a single argument: `null` on success, +or an [`Error`][] object on failure. + +If no `callback` function is provided and the message cannot be sent, an +`'error'` event will be emitted by the [`Worker`][] object. This can +happen, for instance, when the worker has already exited. + + +`worker.send()` will throw an error if the channel has closed or when the +backlog of unsent messages exceeds a threshold that makes it unwise to send +more. Otherwise, the method returns `true`. The `callback` function can be +used to implement flow control. + ## Event: 'disconnect'