Sha256: 686971f50e6813ba8187901f50c9065801fa765799da21dcf976b94a355f5d3b

Contents?: true

Size: 533 Bytes

Versions: 5

Compression:

Stored size: 533 Bytes

Contents

# Usage: $ PUSHER_KEY=YOURKEY ruby examples/hello_pusher.rb

$:.unshift(File.expand_path("../../lib", __FILE__))
require 'pusher-client'
require 'pp'

APP_KEY = ENV['PUSHER_KEY'] # || "YOUR_APPLICATION_KEY"
APP_SECRET = ENV['PUSHER_SECRET'] # || "YOUR_APPLICATION_SECRET"

socket = PusherClient::Socket.new(APP_KEY, { :encrypted => true, :secret => APP_SECRET } )

# Subscribe to a channel
socket.subscribe('private-hellopusher')

# Bind to a channel event
socket['hellopusher'].bind('hello') do |data|
  pp data
end

socket.connect

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pusher-client-0.6.2 examples/subscribe_private.rb
pusher-client-0.6.1 examples/subscribe_private.rb
pusher-client-0.6.0 examples/subscribe_private.rb
pusher-client-0.5.0 examples/subscribe_private.rb
pusher-client-0.4.0 examples/subscribe_private.rb