Sha256: 6f4d0b1c5276a11723aa6d7f13fe9a9dd3711f01150fd407c095347ce2af2c45

Contents?: true

Size: 882 Bytes

Versions: 38

Compression:

Stored size: 882 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'

module Volt
  # 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!
      fail 'close! should not be called on the backend channel'
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
volt-0.9.3.pre1 lib/volt/page/channel_stub.rb
volt-0.9.2 lib/volt/page/channel_stub.rb
volt-0.9.1 lib/volt/page/channel_stub.rb
volt-0.9.1.pre5 lib/volt/page/channel_stub.rb
volt-0.9.1.pre4 lib/volt/page/channel_stub.rb
volt-0.9.1.pre3 lib/volt/page/channel_stub.rb
volt-0.9.1.pre2 lib/volt/page/channel_stub.rb
volt-0.9.1.pre1 lib/volt/page/channel_stub.rb
volt-0.9.0 lib/volt/page/channel_stub.rb
volt-0.9.0.pre7 lib/volt/page/channel_stub.rb
volt-0.9.0.pre6 lib/volt/page/channel_stub.rb
volt-0.9.0.pre5 lib/volt/page/channel_stub.rb
volt-0.9.0.pre4 lib/volt/page/channel_stub.rb
volt-0.9.0.pre3 lib/volt/page/channel_stub.rb
volt-0.9.0.pre2 lib/volt/page/channel_stub.rb
volt-0.9.0.pre1 lib/volt/page/channel_stub.rb
volt-0.8.27.beta9 lib/volt/page/channel_stub.rb
volt-0.8.27.beta8 lib/volt/page/channel_stub.rb
volt-0.8.27.beta7 lib/volt/page/channel_stub.rb
volt-0.8.27.beta6 lib/volt/page/channel_stub.rb