Python Brewer API
Brewer API is provided as a notion of an interface with implementation details provided for specific negotiated pubkeeper protocol.
__init__(topic, crypto=True, brewer_id=None)
topic—The topic to be published to
crypto—Should the brewed data be encrypted
brewer_id—If set, use this as the brewer's ID rather than generating one
Creating a brewer is simple: it's an object with a topic to be produced. When adding this brewer object to the client, it will inherit all the brews available to the client for use.
Called when connected to a pubkeeper server. Allows the protocol implementation to create cipher keys, or any other setup necessary.
This method returns any brewer-specific configuration that is needed for registration. This may include cryptographic information that patrons will need to decrypt brewed data.
patrons—List of patrons that are to be subscribed to our brewed data
List element format
patron_id—UUID of patron that is subscribing to us
brew—Brew method of consuming our data
Called when a patron_notify packet is received from the server with the ID and brew of the newly connected patrons.
patron_id—Patron ID of a removed patron
Called when a patron_removed packet is received from the server with the ID of the disconnected patron.
Called when disconnected from a pubkeeper server, to cleanup any protocol specific data associated to this brewer
data—The data to be published
This is where you send data to be published in this brewer's topic. The data must be bytes format.