Module: SimplePusher
- Defined in:
- lib/simple_pusher.rb,
lib/simple_pusher/engine.rb,
lib/simple_pusher/server.rb,
lib/simple_pusher/version.rb,
lib/simple_pusher/connection.rb,
lib/simple_pusher/middleware.rb,
lib/simple_pusher/sinatra_app.rb,
lib/simple_pusher/configuration.rb
Defined Under Namespace
Classes: Configuration, Connection, Engine, Middleware, Server, SinatraApp
Constant Summary
collapse
- VERSION =
'0.0.6'
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
18
19
20
|
# File 'lib/simple_pusher.rb', line 18
def configuration
@_configuration ||= Configuration.new
end
|
.on(event, &callback) ⇒ Object
35
36
37
|
# File 'lib/simple_pusher.rb', line 35
def on(event, &callback)
Connection.on(event, &callback)
end
|
.publish(channel, message = '') ⇒ Object
Publish message to all connected socket. And the client websocket which listened ‘channel’ will get message callback.
31
32
33
|
# File 'lib/simple_pusher.rb', line 31
def publish(channel, message = '')
Connection.publish(channel, message)
end
|
.setup {|configuration| ... } ⇒ Object
13
14
15
16
|
# File 'lib/simple_pusher.rb', line 13
def setup
yield configuration
configuration
end
|
.start(_options = {}) ⇒ Object
23
24
25
26
27
|
# File 'lib/simple_pusher.rb', line 23
def start(_options = {})
EventMachine.next_tick do
Server.start
end
end
|