Sha256: 6f00d7bb14e5f65924927457b26569785743ad5c405c1ff4783d40a7ba49f959

Contents?: true

Size: 880 Bytes

Versions: 23

Compression:

Stored size: 880 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

23 entries across 23 versions & 1 rubygems

Version Path
volt-0.7.23 lib/volt/page/channel_stub.rb
volt-0.7.22 lib/volt/page/channel_stub.rb
volt-0.7.21 lib/volt/page/channel_stub.rb
volt-0.7.20 lib/volt/page/channel_stub.rb
volt-0.7.19 lib/volt/page/channel_stub.rb
volt-0.7.18 lib/volt/page/channel_stub.rb
volt-0.7.17 lib/volt/page/channel_stub.rb
volt-0.7.16 lib/volt/page/channel_stub.rb
volt-0.7.15 lib/volt/page/channel_stub.rb
volt-0.7.14 lib/volt/page/channel_stub.rb
volt-0.7.13 lib/volt/page/channel_stub.rb
volt-0.7.12 lib/volt/page/channel_stub.rb
volt-0.7.10 lib/volt/page/channel_stub.rb
volt-0.7.9 lib/volt/page/channel_stub.rb
volt-0.7.8 lib/volt/page/channel_stub.rb
volt-0.7.7 lib/volt/page/channel_stub.rb
volt-0.7.6 lib/volt/page/channel_stub.rb
volt-0.7.5 lib/volt/page/channel_stub.rb
volt-0.7.4 lib/volt/page/channel_stub.rb
volt-0.7.3 lib/volt/page/channel_stub.rb