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.6.5.pre vendor/pusher-gem/examples/async_message.rb
scout-5.6.4 vendor/pusher-gem/examples/async_message.rb
scout-5.6.3.pre vendor/pusher-gem/examples/async_message.rb
scout-5.6.2 vendor/pusher-gem/examples/async_message.rb
scout-5.6.2.pre vendor/pusher-gem/examples/async_message.rb
scout-5.6.1 vendor/pusher-gem/examples/async_message.rb
scout-5.6.0 vendor/pusher-gem/examples/async_message.rb
pusher-0.11.3 examples/async_message.rb
pusher-0.11.2 examples/async_message.rb
pusher-0.11.1 examples/async_message.rb
scout-5.6.0.alpha.4 vendor/pusher-gem/examples/async_message.rb
scout-5.6.0.alpha.3 vendor/pusher-gem/examples/async_message.rb
scout-5.6.0.alpha.2 vendor/pusher-gem/examples/async_message.rb
scout-5.6.0.alpha vendor/pusher-gem/examples/async_message.rb
pusher-0.11.0 examples/async_message.rb
scout-5.5.10 vendor/pusher-gem/examples/async_message.rb
pusher-0.10.0 examples/async_message.rb
scout-5.5.9 vendor/pusher-gem/examples/async_message.rb
scout-5.5.9.pre.2 vendor/pusher-gem/examples/async_message.rb
scout-5.5.9.pre vendor/pusher-gem/examples/async_message.rb