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
pusher-2.0.0 examples/async_message.rb
pusher-1.4.3 examples/async_message.rb
pusher-1.4.2 examples/async_message.rb
pusher-1.4.1 examples/async_message.rb
pusher-1.4.0 examples/async_message.rb
scout-5.9.13 vendor/pusher/examples/async_message.rb
pusher-1.3.3 examples/async_message.rb
pusher-1.3.2 examples/async_message.rb
scout-5.9.12 vendor/pusher/examples/async_message.rb
scout-5.9.11 vendor/pusher/examples/async_message.rb
pusher-1.3.1 examples/async_message.rb
pusher-1.3.0 examples/async_message.rb
pusher-1.2.1 examples/async_message.rb
pusher-1.2.0 examples/async_message.rb
pusher-1.2.0.rc4 examples/async_message.rb
pusher-1.2.0.rc3 examples/async_message.rb
pusher-1.2.0.rc2 examples/async_message.rb
pusher-1.2.0.rc1 examples/async_message.rb
pusher-1.1.0 examples/async_message.rb
pusher-1.0.0 examples/async_message.rb