Class: ChannelStub
- Includes:
- ReactiveTags
- 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 ReactiveTags
included, #reactive_method_tag
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
35 36 37 |
# File 'lib/volt/page/channel_stub.rb', line 35 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', nil, *) 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
31 32 33 |
# File 'lib/volt/page/channel_stub.rb', line 31 def () SocketConnectionHandlerStub.new(self).() end |