Publish
Particle.publish - CloudEvent - Publish
Since 6.3.0:
Particle.publish publishes an event from a device. This can be received by zero or more subscribers, including:
- External services using a webhook
- A Logic block to perform operations in the cloud
- Another device using
Particle.subscribe()
- The server-sent events (SSE) data stream
// PROTOTYPE
bool publish(particle::CloudEvent event);
This variation is available in Device OS 6.3.0 and later and is the recommended syntax. The CloudEvent
class
is both a container for the event name, event data, and content type, but also maintains the process in
publishing and any error that occurs while publishing.
Note that this overload is always asynchronous and does not use a Future
as the other overloads below.
For more information and examples, see the typed and extended publish page.