motion-pusher
A ruby motion wrapper gem to interact with the pusher cocoapod
Installation
Add this line to your application's Gemfile:
gem 'motion-pusher'
If you are not currently using cocoapods, update your Rakefile
require 'rubygems' require 'motion-cocoapods'
And then execute:
$ bundle
$ rake pod:setup
$ rake pod:install
Usage
Configure your Rakefile
app.pusher do
app.pusher.key = <PUSHER_KEY>
app.pusher.authorization_url = <AUTH_URL_FOR_PRIVATE_CHANNELS>
end
And create your first connection
class PusherClient
attr_accessor :client
def initialize
self.client = MotionPusherClient.new(self)
client.connect
channel = client.subscribe_to('cool-public-channel')
channel.bindToEventNamed('new-message', handleWithBlock: -> (channel_event) {
puts channel_event.data['message']
})
end
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request