Sha256: 9fb2eb46d3a4ad2af30f52d5dcc27db25f22aafef8b855fca5b6c9836f445041

Contents?: true

Size: 850 Bytes

Versions: 113

Compression:

Stored size: 850 Bytes

Contents

# frozen_string_literal: true

require "websocket/driver"

module ActionCable
  module Connection
    # Wrap the real socket to minimize the externally-presented API
    class WebSocket # :nodoc:
      def initialize(env, event_target, event_loop, protocols: ActionCable::INTERNAL[:protocols])
        @websocket = ::WebSocket::Driver.websocket?(env) ? ClientSocket.new(env, event_target, event_loop, protocols) : nil
      end

      def possible?
        websocket
      end

      def alive?
        websocket && websocket.alive?
      end

      def transmit(data)
        websocket.transmit data
      end

      def close
        websocket.close
      end

      def protocol
        websocket.protocol
      end

      def rack_response
        websocket.rack_response
      end

      private
        attr_reader :websocket
    end
  end
end

Version data entries

113 entries across 109 versions & 9 rubygems

Version Path
actioncable-7.0.8.6 lib/action_cable/connection/web_socket.rb
actioncable-6.1.7.10 lib/action_cable/connection/web_socket.rb
actioncable-6.1.7.9 lib/action_cable/connection/web_socket.rb
actioncable-7.0.8.5 lib/action_cable/connection/web_socket.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/actioncable-7.0.8.4/lib/action_cable/connection/web_socket.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/actioncable-7.0.5.1/lib/action_cable/connection/web_socket.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/actioncable-7.0.5.1/lib/action_cable/connection/web_socket.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/actioncable-7.0.5.1/lib/action_cable/connection/web_socket.rb
actioncable-7.0.8.4 lib/action_cable/connection/web_socket.rb
actioncable-6.1.7.8 lib/action_cable/connection/web_socket.rb
actioncable-7.0.8.1 lib/action_cable/connection/web_socket.rb
actioncable-6.1.7.7 lib/action_cable/connection/web_socket.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actioncable-7.0.3.1/lib/action_cable/connection/web_socket.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actioncable-7.0.2.3/lib/action_cable/connection/web_socket.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actioncable-6.1.6.1/lib/action_cable/connection/web_socket.rb
actioncable-7.0.8 lib/action_cable/connection/web_socket.rb
actioncable-7.0.7.2 lib/action_cable/connection/web_socket.rb
actioncable-6.1.7.6 lib/action_cable/connection/web_socket.rb
actioncable-7.0.7.1 lib/action_cable/connection/web_socket.rb
actioncable-6.1.7.5 lib/action_cable/connection/web_socket.rb