Class: Async::WebSocket::Connection
- Inherits:
-
Protocol::WebSocket::Connection
- Object
- Protocol::WebSocket::Connection
- Async::WebSocket::Connection
- Includes:
- Protocol::WebSocket::Headers
- Defined in:
- lib/async/websocket/connection.rb
Overview
This is a basic synchronous websocket client:
Instance Attribute Summary collapse
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(framer, protocol = nil, **options) ⇒ Connection
constructor
A new instance of Connection.
- #inspect ⇒ Object
- #reusable? ⇒ Boolean
Constructor Details
#initialize(framer, protocol = nil, **options) ⇒ Connection
Returns a new instance of Connection.
34 35 36 37 38 |
# File 'lib/async/websocket/connection.rb', line 34 def initialize(framer, protocol = nil, **) super(framer, **) @protocol = protocol end |
Instance Attribute Details
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
44 45 46 |
# File 'lib/async/websocket/connection.rb', line 44 def protocol @protocol end |
Class Method Details
.call(framer, protocol = [], extensions = nil, **options) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/async/websocket/connection.rb', line 20 def self.call(framer, protocol = [], extensions = nil, **) instance = self.new(framer, Array(protocol).first, **) extensions&.apply(instance) return instance unless block_given? begin yield instance ensure instance.close end end |
Instance Method Details
#inspect ⇒ Object
46 47 48 |
# File 'lib/async/websocket/connection.rb', line 46 def inspect "#<#{self.class} state=#{@state}>" end |
#reusable? ⇒ Boolean
40 41 42 |
# File 'lib/async/websocket/connection.rb', line 40 def reusable? false end |