Event streams
Use this reference with the complete developer tour and Go types. The example at the end runs after the tour setup.
StreamEvents
Section titled “StreamEvents”Consume authorized canonical events with reconnect and a sequence checkpoint.
func (c *Client) StreamEvents(ctx context.Context, options EventOptions, handle func(Event) error) error| Parameter | Type and default | Usage |
|---|---|---|
ctx |
context.Context (required) |
Required Go context. Cancellation bounds this local call; it does not withdraw a durable request. |
options |
EventOptions (required) |
Optional fields supported by this operation, listed in the linked HTTP input. Unknown fields are not a supported extension mechanism. |
handle |
func(Event) error (required) |
Required event callback; return an error to stop without advancing the handled checkpoint. |
Returns: Python iterator or TypeScript async iterator of events; Go callback with error return.
Permissions, lifecycle and errors: Persist a checkpoint after applying each event. Go options add conversation filtering; Python supports conversation_id; TypeScript EventOptions exposes after, summary and signal. Summary streams omit full bodies. A denial stops reconnecting.
Working Go example. Input/output fields are in the types reference.
Example
Section titled “Example”Run this region after the shared setup. Assertions check the returned data; the full tour is a runnable program.
streamCtx, cancelStream := context.WithTimeout(ctx, 5*time.Second)found := falseerr = billing.StreamEvents(streamCtx, beepgrid.EventOptions{}, func(event beepgrid.Event) error { if event.Kind == "message.created" && event.ConversationID == sent.ConversationID { check(event.Sequence > 0) found = true cancelStream() } return nil // Persist the checkpoint only after applying the event.})check(found && err != nil)cancelStream()