Class: RenderSync::Clients::Pusher::Message
- Inherits:
-
Object
- Object
- RenderSync::Clients::Pusher::Message
- Defined in:
- lib/render_sync/clients/pusher.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#data ⇒ Object
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(channel, data) ⇒ Message
constructor
A new instance of Message.
- #publish ⇒ Object
- #publish_asynchronous ⇒ Object
- #publish_synchronous ⇒ Object
Constructor Details
#initialize(channel, data) ⇒ Message
Returns a new instance of Message.
52 53 54 55 |
# File 'lib/render_sync/clients/pusher.rb', line 52 def initialize(channel, data) self.channel = channel self.data = data end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
44 45 46 |
# File 'lib/render_sync/clients/pusher.rb', line 44 def channel @channel end |
#data ⇒ Object
Returns the value of attribute data.
44 45 46 |
# File 'lib/render_sync/clients/pusher.rb', line 44 def data @data end |
Class Method Details
.batch_publish(messages) ⇒ Object
46 47 48 49 50 |
# File 'lib/render_sync/clients/pusher.rb', line 46 def self.batch_publish() .each do || .publish end end |
Instance Method Details
#publish ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/render_sync/clients/pusher.rb', line 57 def publish if RenderSync.async? publish_asynchronous else publish_synchronous end end |
#publish_asynchronous ⇒ Object
69 70 71 72 73 |
# File 'lib/render_sync/clients/pusher.rb', line 69 def publish_asynchronous RenderSync.reactor.perform do ::Pusher.trigger_async([channel], 'sync', data) end end |
#publish_synchronous ⇒ Object
65 66 67 |
# File 'lib/render_sync/clients/pusher.rb', line 65 def publish_synchronous ::Pusher.trigger([channel], 'sync', data) end |