Class: ChannelStub

Inherits:
Object show all
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

Instance Method Summary collapse

Methods included from ReactiveTags

included, #reactive_method_tag

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



13
14
15
# File 'lib/volt/page/channel_stub.rb', line 13

def error
  @error
end

#reconnect_intervalObject (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

#stateObject (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

#initiailzeObject



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 message_received(*message)
  trigger!('message', nil, *message)
end

#openedObject



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 send_message(message)
  SocketConnectionHandlerStub.new(self).process_message(message)
end