Module: Breakout::Worker::API
- Included in:
- App
- Defined in:
- lib/breakout/api.rb
Instance Method Summary collapse
-
#disconnect(bid) ⇒ Object
commands are symbols :send_messages, :disconnect, :done_work commands are sent to breakout server as a hash :command => args args are :done_work => requeue? #true or false whether to put worker back on work queue :send_messages => { message => [bid1, bid2, …] } :disconnect => bid.
- #done_work(requeue = true) ⇒ Object
- #send_messages(args) ⇒ Object (also: #send_message)
Instance Method Details
#disconnect(bid) ⇒ Object
commands are symbols :send_messages, :disconnect, :done_work commands are sent to breakout server as a hash :command => args args are
:done_work => requeue? #true or false whether to put worker back on work queue
:send_messages => { message => [bid1, bid2, ...] }
:disconnect => bid
for messages incoming from the server (in worker.do_work) the notify api
(if the browser url included notify=true)
when the browser socket opens, the message will be "/open"
when the browser socket closes, the mesage will be "/close"
19 20 21 |
# File 'lib/breakout/api.rb', line 19 def disconnect(bid) socket.send :disconnect => bid end |
#done_work(requeue = true) ⇒ Object
30 31 32 |
# File 'lib/breakout/api.rb', line 30 def done_work(requeue=true) socket.send :done_work => requeue end |
#send_messages(args) ⇒ Object Also known as: send_message
23 24 25 26 |
# File 'lib/breakout/api.rb', line 23 def (args) raise Exception unless args.is_a?(Hash) socket.send :send_messages => args end |