Installing
The SDK is available on Github, so available via the standardgo get
Basic Usage
Importing
Thesailhouse
package has all the goodness in it.
Initialising the Client
The package has aSailhouseClient
struct which holds all the methods for interacting with the Sailhouse platform.
Provided you have generated a token, you can create a client easily with sailhouse.NewSailhouseClient(...)
Sending an event
The client has aPublish(...)
method on it for easily sending data to a given topic
data
arg must be able to be marshalled into JSON via json.Marshal
. If this fails, it will return an error, and the event will not be sent.
Receiving events from a pull subscription
The client also has aGetEvents(...)
method for requesting the events sent to a given subscription for a topic.
Admin Operations
The admin client provides methods for managing subscriptions programmatically.Registering Push Subscriptions
Rate Limiting and Deduplication
- Rate Limit: Controls delivery frequency using formats like “100/h” (100 per hour), “10/m” (10 per minute)
- Deduplication: Prevents duplicate deliveries within a time window using formats like “5m” (5 minutes), “1h” (1 hour)