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.5.8 vendor/pusher-gem/examples/async_message.rb
scout-5.5.8.pre vendor/pusher-gem/examples/async_message.rb
scout-5.5.7 vendor/pusher-gem/examples/async_message.rb
scout-5.5.6 vendor/pusher-gem/examples/async_message.rb
scout-5.5.6.pre4 vendor/pusher-gem/examples/async_message.rb
scout-5.5.6.pre vendor/pusher-gem/examples/async_message.rb
scout-5.5.5 vendor/pusher-gem/examples/async_message.rb
pusher-0.9.4 examples/async_message.rb
pusher-0.9.3 examples/async_message.rb
scout-5.5.4 vendor/pusher-gem/examples/async_message.rb
pusher-0.9.2 examples/async_message.rb
pusher-0.9.1 examples/async_message.rb
pusher-0.9.0 examples/async_message.rb
scout-5.5.3 vendor/pusher-gem/examples/async_message.rb
scout-5.5.2 vendor/pusher-gem/examples/async_message.rb
scout-5.5.1 vendor/pusher-gem/examples/async_message.rb
scout-5.5.0 vendor/pusher-gem/examples/async_message.rb
scout-5.4.6.alpha vendor/pusher-gem/examples/async_message.rb
scout-5.4.5.1.alpha vendor/pusher-gem/examples/async_message.rb
scout-5.4.5.alpha vendor/pusher-gem/examples/async_message.rb