[][src]Crate pusher


The Rust library for interacting with the Pusher HTTP API.

This package lets you trigger events to your client and query the state of your Pusher channels. When used with a server, you can validate Pusher webhooks and authenticate private- or presence-channels.

In order to use this library, you need to have a free account on http://pusher.com. After registering, you will need the application credentials for your app.

Getting Started

Firstly, add pusher to your Cargo.toml.

To trigger an event:

extern crate pusher; // imports the `pusher` module

use pusher::PusherBuilder; // brings the PusherBuilder struct into scope

fn main(){
  // initializes a Pusher object with your app credentials
  let pusher = PusherBuilder::new("APP_ID", "KEY", "SECRET").finalize();

  // triggers an event called "my_event" on a channel called "test_channel", with the payload "hello world!"
  pusher.trigger("test_channel", "my_event", "hello world!");




This represents the data received upon querying the state of a Pusher channel.


A list of channels returned by the API.


A particular user who occupies a presence channel.


The list of users subscribed to a presence channel, as returned by the Pusher API.


When authenticating presence-channels, this represents a particular member of the channel. This object becomes associated with that user's subscription.


A client to interact with Pusher's HTTP API to trigger, query application state, authenticate private- or presence-channels, and validate webhooks.


An ephemeral object upon which to pass configuration options to when initializing a Pusher instance.


Any event_ids returned by the HTTP API, if connected to certain clusters.


This is returned upon validating that a webhook is indeed from Pusher, carrying all the data received by that POST request.

Type Definitions


When querying the state of Pusher channels, you can pass this in to specify options.