Sha256: 09bfd19018102319bf622e5795cbdc0386750e1291fa4824e6382a498da06f89

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

require "pakyow/framework"

require "pakyow/realtime/helpers/broadcasting"
require "pakyow/realtime/helpers/subscriptions"
require "pakyow/realtime/helpers/socket"

require "pakyow/realtime/behavior/config"
require "pakyow/realtime/behavior/serialization"
require "pakyow/realtime/behavior/server"
require "pakyow/realtime/behavior/silencing"

require "pakyow/realtime/actions/upgrader"

require "pakyow/realtime/behavior/rendering/install_websocket"

module Pakyow
  module Realtime
    class Framework < Pakyow::Framework(:realtime)
      def boot
        object.class_eval do
          register_helper :active, Helpers::Broadcasting
          register_helper :active, Helpers::Subscriptions
          register_helper :passive, Helpers::Socket

          # Socket events are triggered on the app.
          #
          events :join, :leave

          include Behavior::Config
          include Behavior::Server
          include Behavior::Silencing
          include Behavior::Serialization

          isolated :Renderer do
            include Behavior::Rendering::InstallWebsocket
          end

          isolated :Connection do
            after "initialize" do
              set(:__socket_client_id, params[:socket_client_id] || Support::MessageVerifier.key)
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pakyow-realtime-1.0.0.rc2 lib/pakyow/realtime/framework.rb
pakyow-realtime-1.0.0.rc1 lib/pakyow/realtime/framework.rb