Sha256: 0523c5941507bdcbc484abea0f129d2a9e85ea06a756f0e15f88c19ef44b31d0

Contents?: true

Size: 821 Bytes

Versions: 14

Compression:

Stored size: 821 Bytes

Contents

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

require 'volt/tasks/dispatcher'
require 'volt/reactive/eventable'

# 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 Eventable

  attr_reader :state, :error, :reconnect_interval

  def initiailze
    @state = :connected
  end

  def opened
    trigger!('open')
    trigger!('changed')
  end

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

14 entries across 14 versions & 1 rubygems

Version Path
volt-0.8.14 lib/volt/page/channel_stub.rb
volt-0.8.13 lib/volt/page/channel_stub.rb
volt-0.8.11 lib/volt/page/channel_stub.rb
volt-0.8.10 lib/volt/page/channel_stub.rb
volt-0.8.9 lib/volt/page/channel_stub.rb
volt-0.8.8 lib/volt/page/channel_stub.rb
volt-0.8.7 lib/volt/page/channel_stub.rb
volt-0.8.6 lib/volt/page/channel_stub.rb
volt-0.8.5 lib/volt/page/channel_stub.rb
volt-0.8.4 lib/volt/page/channel_stub.rb
volt-0.8.3 lib/volt/page/channel_stub.rb
volt-0.8.2 lib/volt/page/channel_stub.rb
volt-0.8.1 lib/volt/page/channel_stub.rb
volt-0.8.0 lib/volt/page/channel_stub.rb