Sha256: ac9fb0110327ccb62e92e40cc4cf9594ea2b7a76f2535a73628fd7b3c92f509e

Contents?: true

Size: 453 Bytes

Versions: 1

Compression:

Stored size: 453 Bytes

Contents

# frozen_string_literal: true

module Logux
  class ChannelController < BaseController
    def subscribe
      Logux.add_batch(initial_data.map { |d| [d, initial_meta] })
    end

    def initial_data
      []
    end

    def initial_meta
      { clients: [meta.client_id] }
    end

    def since_time
      @since_time ||= begin
        since = action['since'].try(:[], 'time')
        Time.at(since).to_datetime if since
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logux_rails-0.1.0 lib/logux/channel_controller.rb