Sha256: 529a4dad1720b77587469f1502ce6f90ce567ea089b3e4d472f2490693459197

Contents?: true

Size: 900 Bytes

Versions: 18

Compression:

Stored size: 900 Bytes

Contents

# frozen_string_literal: true

require "websocket/driver"

module ActionCable
  module Connection
    # = Action Cable \Connection \WebSocket
    #
    # 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

18 entries across 18 versions & 4 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/actioncable-7.1.3.4/lib/action_cable/connection/web_socket.rb
actioncable-7.1.5.1 lib/action_cable/connection/web_socket.rb
actioncable-7.1.5 lib/action_cable/connection/web_socket.rb
actioncable-7.1.4.2 lib/action_cable/connection/web_socket.rb
actioncable-7.1.4.1 lib/action_cable/connection/web_socket.rb
actioncable-7.1.4 lib/action_cable/connection/web_socket.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/actioncable-7.1.3.4/lib/action_cable/connection/web_socket.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/actioncable-7.1.3.4/lib/action_cable/connection/web_socket.rb
actioncable-7.1.3.4 lib/action_cable/connection/web_socket.rb
actioncable-7.1.3.2 lib/action_cable/connection/web_socket.rb
actioncable-7.1.3.1 lib/action_cable/connection/web_socket.rb
actioncable-7.1.3 lib/action_cable/connection/web_socket.rb
actioncable-7.1.2 lib/action_cable/connection/web_socket.rb
actioncable-7.1.1 lib/action_cable/connection/web_socket.rb
actioncable-7.1.0 lib/action_cable/connection/web_socket.rb
actioncable-7.1.0.rc2 lib/action_cable/connection/web_socket.rb
actioncable-7.1.0.rc1 lib/action_cable/connection/web_socket.rb
actioncable-7.1.0.beta1 lib/action_cable/connection/web_socket.rb