Sha256: aaaf627efa9afedf28c73a1375cf71b882ddbc42afa3d56cb1246826fa41d1e9

Contents?: true

Size: 606 Bytes

Versions: 125

Compression:

Stored size: 606 Bytes

Contents

require 'rubygems'
require 'pusher'
require 'eventmachine'
require 'em-http-request'

# To get these values:
# - Go to https://app.pusherapp.com/
# - Click on Choose App.
# - Click on one of your apps
# - Click API Access
Pusher.app_id = 'your_app_id'
Pusher.key = 'your_key'
Pusher.secret = 'your_secret'


EM.run {
  deferrable = Pusher['test_channel'].trigger_async('my_event', 'hi')

  deferrable.callback { # called on success
    puts "Message sent successfully."
    EM.stop
  }
  deferrable.errback { |error| # called on error
    puts "Message could not be sent."
    puts error
    EM.stop
  }
}

Version data entries

125 entries across 125 versions & 2 rubygems

Version Path
scout-5.7.4 vendor/pusher/examples/async_message.rb
scout-5.7.3.pre.2 vendor/pusher/examples/async_message.rb
scout-5.7.3.pre vendor/pusher/examples/async_message.rb
scout-5.7.2 vendor/pusher/examples/async_message.rb
scout-5.7.2.pre.2 vendor/pusher/examples/async_message.rb
scout-5.7.2.pre vendor/pusher/examples/async_message.rb
scout-5.7.1 vendor/pusher-gem/examples/async_message.rb
scout-5.7.0 vendor/pusher-gem/examples/async_message.rb
scout-5.7.0.pre vendor/pusher-gem/examples/async_message.rb
scout-5.6.11 vendor/pusher-gem/examples/async_message.rb
pusher-0.12.0 examples/async_message.rb
scout-5.6.10 vendor/pusher-gem/examples/async_message.rb
scout-5.6.9 vendor/pusher-gem/examples/async_message.rb
scout-5.6.8 vendor/pusher-gem/examples/async_message.rb
scout-5.6.8.pre vendor/pusher-gem/examples/async_message.rb
scout-5.6.7 vendor/pusher-gem/examples/async_message.rb
scout-5.6.7.pre vendor/pusher-gem/examples/async_message.rb
scout-5.6.6 vendor/pusher-gem/examples/async_message.rb
scout-5.6.6.pre vendor/pusher-gem/examples/async_message.rb
scout-5.6.5 vendor/pusher-gem/examples/async_message.rb