Class: ChannelStub
- Includes:
- Eventable
- Defined in:
- lib/volt/page/channel_stub.rb
Overview
Behaves the same as the Channel class, only the Channel class uses sockjs to pass messages to the backend. ChannelStub, simply passes them directly to SocketConnectionHandlerStub.
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#reconnect_interval ⇒ Object
readonly
Returns the value of attribute reconnect_interval.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #close! ⇒ Object
- #initiailze ⇒ Object
- #message_received(*message) ⇒ Object
- #opened ⇒ Object
- #send_message(message) ⇒ Object
Methods included from Eventable
#on, #remove_listener, #trigger!
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
13 14 15 |
# File 'lib/volt/page/channel_stub.rb', line 13 def error @error end |
#reconnect_interval ⇒ Object (readonly)
Returns the value of attribute reconnect_interval.
13 14 15 |
# File 'lib/volt/page/channel_stub.rb', line 13 def reconnect_interval @reconnect_interval end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
13 14 15 |
# File 'lib/volt/page/channel_stub.rb', line 13 def state @state end |
Instance Method Details
#close! ⇒ Object
32 33 34 |
# File 'lib/volt/page/channel_stub.rb', line 32 def close! raise "close! should not be called on the backend channel" end |
#initiailze ⇒ Object
15 16 17 |
# File 'lib/volt/page/channel_stub.rb', line 15 def initiailze @state = :connected end |
#message_received(*message) ⇒ Object
24 25 26 |
# File 'lib/volt/page/channel_stub.rb', line 24 def (*) trigger!('message', *) end |
#opened ⇒ Object
19 20 21 22 |
# File 'lib/volt/page/channel_stub.rb', line 19 def opened trigger!('open') trigger!('changed') end |
#send_message(message) ⇒ Object
28 29 30 |
# File 'lib/volt/page/channel_stub.rb', line 28 def () SocketConnectionHandlerStub.new(self).() end |