Sha256: 5f02a272b36cd2429e3933a2a8b38520662c4eb52eccb6e96705ed7b8d270940

Contents?: true

Size: 440 Bytes

Versions: 5

Compression:

Stored size: 440 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"

socket = PusherClient::Socket.new(APP_KEY)
socket.connect(true)

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

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

loop do
  sleep 1
end

Version data entries

5 entries across 5 versions & 1 rubygems

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