Events and Operations

Let’s examine how a robot participates in a wave. A robot typically reacts to events that occur within a wave by performing a specific operation (or operations) on wavelets in which it is a participant.

For the most part, a robot initiates action in a wave in response to a particular event to which it is subscribed, although in some instances a robot can also initiate operations on wavelets on its own (see the section An “Active” API). Figure 6-8 illustrates how a robot might respond to certain events through operations on a wave and its respective parts.

The Wave Robot Protocol sends event notifications to a robot, based on its capabilities. Depending on the event, the robot responds with one or more operations that affect a wave.

Figure 6-8. The Wave Robot Protocol sends event notifications to a robot, based on its capabilities. Depending on the event, the robot responds with one or more operations that affect a wave.

An “Active” API

The initial Robots API client libraries were limited in terms of how a robot could initiate action with waves without relying on event handlers. Although a pseudo cron mechanism was available to configure a wave to automatically contact a robot on a recurring basis, this approach still did not allow a robot to perform operations autonomously.

The latest set of client libraries enable robots to be autonomous participants through an “active” API so that they can create new waves or add new information to waves at any time. This new capability relies on authentication via OAuth and operations sent to a robot proxy ...

Get Google Wave: Up and Running now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.