You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cube provides a JavaScript WebSockets client for posting events to a collector. This is handy for writing emitters: programs that send events to Cube. Here's a simple Node script for posting a single "random" event to a collector running on localhost:1080:
While you can easily write an emitter yourself using WebSockets, Cube's emitter is nice because it will automatically reconnect and retry on error. Also, if you ^C a daemon emitter and call client.close(), the emitter will wait until it has flushed all queued events before closing.
The emitter client can also be used to send events via UDP:
Note that with UDP there is little error detection: if the Collector isn't running, the emitter won't notice! This is nice if you want fire-and-forget events and the greatest possible throughput; on the other hand, if you want to notice when events are not received by the collector, then use the WebSocket interface instead.