Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
= pusher-client (Ruby)
{}[https://travis-ci.org/pusher/pusher-websocket-ruby]
pusher-client is a ruby gem for consuming WebSockets from the Pusher[http://pusherapp.com] web service.
The connection to Pusher can optionally be maintained in its own thread (see Asynchronous Usage).
This gem no longer depends on em-http, and is compatible with jruby since 0.2.
When binding to a global event, note that you still must be subscribed to the channels the event may be sent on. You can't just bind a global event without subscribing to any channels and call it a day.
== Installation gem install pusher-client
== Single-Threaded Usage The application will pause at socket.connect and handle events from Pusher as they happen.
require 'pusher-client' options = { secure: true } socket = PusherClient::Socket.new(YOUR_APPLICATION_KEY, options)
socket.subscribe('channel1') socket.subscribe('channel2')
socket.subscribe('presence-channel3', USER_ID)
socket.subscribe('private-channel4', USER_ID)
socket.subscribe('presence-channel5', :user_id => USER_ID, :user_name => 'john')
socket.bind('globalevent') do |data| puts data end
socket['channel1'].bind('channelevent') do |data| puts data end
socket.connect
== Asynchronous Usage The socket will remain open in the background as long as your main application thread is running, and you can continue to subscribe/unsubscribe to channels and bind new events.
require 'pusher-client' socket = PusherClient::Socket.new(YOUR_APPLICATION_KEY) socket.connect(true) # Connect asynchronously
socket.subscribe('channel1') socket.subscribe('channel2')
socket.bind('globalevent') do |data| puts data end
socket['channel1'].bind('channelevent') do |data| puts data end
loop do sleep(1) # Keep your main thread running end
For further documentation, read the source & test suite. Some features of the JavaScript client are not yet implemented.
== Native extension Pusher depends on the websocket[https://github.com/imanel/websocket-ruby] gem which is a pure Ruby implementation of websockets.
However it can optionally use a native C or Java implementation for a 25% speed increase by including the websocket-native[https://github.com/imanel/websocket-ruby-native] gem in your Gemfile.
== Contributing to pusher-client
== Copyright
Copyright (c) 2010 Logan Koester. See LICENSE.txt for further details.
FAQs
Unknown package
We found that pusher-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.