Server API overview

The Server API Overview provides information on how to perform specific actions using our Server libraries.

Where possible each section provides an overview of the action, a reference-style guide to the constructor, property or method and an example of how it is used

The reference-style guide and examples may contain information for different languages. You can choose which language you wish to view by clicking on the appropriate tab as below.

  • Rails
  • Ruby
  • PHP
  • Node.js
  • ASP.NET MVC
  • Python
  • Go
  • Java
  • Pusher CLI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# First, run 'gem install pusher'

require 'pusher'

pusher_client = Pusher::Client.new(
  app_id: 'APP_ID',
  key: 'APP_KEY',
  secret: 'APP_SECRET',
  cluster: 'APP_CLUSTER'
)

class HelloWorldController < ApplicationController
  def hello_world
    pusher_client.trigger('my-channel', 'my-event', {:message => 'hello world'})
  end
end
Note! If you created your app in a different cluster to the default us-east-1, you must configure the cluster option as well. See how.

The Guide