Sha256: 1208121c032c3da3911cfeab70f698069f4b44b36326a7b2f7f69e2a584b8600

Contents?: true

Size: 688 Bytes

Versions: 8

Compression:

Stored size: 688 Bytes

Contents

# frozen_string_literal: true

module LiteCable
  module Connection
    # Manage the connection streams
    class Streams
      attr_reader :socket

      def initialize(socket)
        @socket = socket
      end

      # Start streaming from broadcasting to the channel.
      def add(channel_id, broadcasting)
        socket.subscribe(channel_id, broadcasting)
      end

      # Stop streaming from broadcasting to the channel.
      def remove(channel_id, broadcasting)
        socket.unsubscribe(channel_id, broadcasting)
      end

      # Stop all streams for the channel
      def remove_all(channel_id)
        socket.unsubscribe_from_all(channel_id)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
litecable-0.8.2 lib/lite_cable/connection/streams.rb
litecable-0.8.1 lib/lite_cable/connection/streams.rb
litecable-0.8.0 lib/lite_cable/connection/streams.rb
litecable-0.7.2 lib/lite_cable/connection/streams.rb
litecable-0.7.1 lib/lite_cable/connection/streams.rb
litecable-0.7.0 lib/lite_cable/connection/streams.rb
litecable-0.6.0 lib/lite_cable/connection/streams.rb
litecable-0.5.0 lib/lite_cable/connection/streams.rb