Module: MessageBus::Client::MessageHandler
Defined Under Namespace
Classes: SubscribedChannel
Constant Summary
collapse
- CHUNK_SEPARATOR =
The chunk separator for chunked messages.
"\r\n|\r\n"
Instance Method Summary
collapse
Instance Method Details
#initialize(base_url) ⇒ Object
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/message_bus/client/message_handler.rb', line 18
def initialize(base_url)
super
@pending_messages = []
@subscribed_channels = {}
@subscribed_channels.default_proc = proc do |hash, key|
hash[key] = SubscribedChannel.new
end
@payload = String.new
end
|
#subscribe(channel, &callback) ⇒ Object
29
30
31
|
# File 'lib/message_bus/client/message_handler.rb', line 29
def subscribe(channel, &callback)
@subscribed_channels[channel].callbacks << callback
end
|
#unsubscribe ⇒ Object
33
34
|
# File 'lib/message_bus/client/message_handler.rb', line 33
def unsubscribe
end
|