Class: Shove::Http::ChannelContext
- Inherits:
-
Object
- Object
- Shove::Http::ChannelContext
- Defined in:
- lib/shove/http/channel_context.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#channel ⇒ Object
Returns the value of attribute channel.
Instance Method Summary collapse
-
#deny_publish(client, &block) ⇒ Object
deny publishing on the channel
client
the client to denyblock
called on response. -
#deny_subscribe(client, &block) ⇒ Object
deny subscription on the channel
client
the client to denyblock
called on response. -
#grant_publish(client, &block) ⇒ Object
grant publishing on the current channel
client
the client to grantblock
called on response. -
#grant_subscribe(client, &block) ⇒ Object
grant subscription on the channel
client
the client to grantblock
called on response. -
#initialize(app, channel) ⇒ ChannelContext
constructor
A new instance of ChannelContext.
-
#publish(message, &block) ⇒ Object
publish a message on the channel
message
the message to publishblock
called on response.
Constructor Details
#initialize(app, channel) ⇒ ChannelContext
Returns a new instance of ChannelContext.
7 8 9 10 |
# File 'lib/shove/http/channel_context.rb', line 7 def initialize app, channel @app = app @channel = channel end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
5 6 7 |
# File 'lib/shove/http/channel_context.rb', line 5 def app @app end |
#channel ⇒ Object
Returns the value of attribute channel.
5 6 7 |
# File 'lib/shove/http/channel_context.rb', line 5 def channel @channel end |
Instance Method Details
#deny_publish(client, &block) ⇒ Object
deny publishing on the channel client
the client to deny block
called on response
48 49 50 |
# File 'lib/shove/http/channel_context.rb', line 48 def deny_publish client, &block control_request("deny_publish", client, &block) end |
#deny_subscribe(client, &block) ⇒ Object
deny subscription on the channel client
the client to deny block
called on response
41 42 43 |
# File 'lib/shove/http/channel_context.rb', line 41 def deny_subscribe client, &block control_request("deny_subscribe", client, &block) end |
#grant_publish(client, &block) ⇒ Object
grant publishing on the current channel client
the client to grant block
called on response
34 35 36 |
# File 'lib/shove/http/channel_context.rb', line 34 def grant_publish client, &block control_request("grant_publish", client, &block) end |
#grant_subscribe(client, &block) ⇒ Object
grant subscription on the channel client
the client to grant block
called on response
27 28 29 |
# File 'lib/shove/http/channel_context.rb', line 27 def grant_subscribe client, &block control_request("grant_subscribe", client, &block) end |
#publish(message, &block) ⇒ Object
publish a message on the channel message
the message to publish block
called on response
15 16 17 18 19 20 21 22 |
# File 'lib/shove/http/channel_context.rb', line 15 def publish , &block if @channel == "*" raise ShoveException.new("Cannot publish to *") elsif .size > 2048 raise ShoveException.new("Max message size is 2 KiB") end @app.request("publish?channel=#{@channel}").post(, &block) end |