Sha256: d95c5164795680c1c36d92fa3b2efe0d00a528930b38b8fe68981df6309a970f

Contents?: true

Size: 889 Bytes

Versions: 32

Compression:

Stored size: 889 Bytes

Contents

# Acts the same as the Channel class on the front-end, but calls
# directly instead of using sockjs.

require 'volt/reactive/events'
require 'volt/tasks/dispatcher'

# 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.
class ChannelStub
  include ReactiveTags

  attr_reader :state, :error, :reconnect_interval
  
  def initiailze
    @state = :connected
  end
  
  def opened
    trigger!('open')
    trigger!('changed')
  end
  
  def message_received(*message)
    trigger!('message', nil, *message)
  end
  
  tag_method(:send_message) do
    destructive!
  end
  def send_message(message)
    SocketConnectionHandlerStub.new(self).process_message(message)
  end
  
  def close!
    raise "close! should not be called on the backend channel"
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
volt-0.6.5 lib/volt/page/channel_stub.rb
volt-0.6.4 lib/volt/page/channel_stub.rb
volt-0.6.3 lib/volt/page/channel_stub.rb
volt-0.6.2 lib/volt/page/channel_stub.rb
volt-0.6.1 lib/volt/page/channel_stub.rb
volt-0.6.0 lib/volt/page/channel_stub.rb
volt-0.5.18 lib/volt/page/channel_stub.rb
volt-0.5.17 lib/volt/page/channel_stub.rb
volt-0.5.16 lib/volt/page/channel_stub.rb
volt-0.5.15 lib/volt/page/channel_stub.rb
volt-0.5.14 lib/volt/page/channel_stub.rb
volt-0.5.13 lib/volt/page/channel_stub.rb
volt-0.5.12 lib/volt/page/channel_stub.rb
volt-0.5.11 lib/volt/page/channel_stub.rb
volt-0.5.10 lib/volt/page/channel_stub.rb
volt-0.5.9 lib/volt/page/channel_stub.rb
volt-0.5.8 lib/volt/page/channel_stub.rb
volt-0.5.7 lib/volt/page/channel_stub.rb
volt-0.5.6 lib/volt/page/channel_stub.rb
volt-0.5.4 lib/volt/page/channel_stub.rb