Class: Hypertube::Utils::WsConnectionData
- Inherits:
-
ConnectionData
- Object
- ConnectionData
- Hypertube::Utils::WsConnectionData
- Defined in:
- lib/hypertube-ruby-sdk/utils/ws_connection_data.rb
Constant Summary collapse
- DEFAULT_CONNECT_TIMEOUT_SECONDS =
60
Instance Attribute Summary collapse
-
#connect_timeout ⇒ Object
Returns the value of attribute connect_timeout.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
Instance Method Summary collapse
- #connection_type ⇒ Object
-
#initialize(hostname, connect_timeout = DEFAULT_CONNECT_TIMEOUT_SECONDS) ⇒ WsConnectionData
constructor
A new instance of WsConnectionData.
- #serialize_connection_data ⇒ Object
- #to_canonical_key ⇒ Object
- #to_s ⇒ Object
Methods inherited from ConnectionData
#add_header, #add_headers, #headers, #set_headers
Constructor Details
#initialize(hostname, connect_timeout = DEFAULT_CONNECT_TIMEOUT_SECONDS) ⇒ WsConnectionData
Returns a new instance of WsConnectionData.
11 12 13 14 15 |
# File 'lib/hypertube-ruby-sdk/utils/ws_connection_data.rb', line 11 def initialize(hostname, connect_timeout = DEFAULT_CONNECT_TIMEOUT_SECONDS) super() @hostname = hostname @connect_timeout = connect_timeout end |
Instance Attribute Details
#connect_timeout ⇒ Object
Returns the value of attribute connect_timeout.
9 10 11 |
# File 'lib/hypertube-ruby-sdk/utils/ws_connection_data.rb', line 9 def connect_timeout @connect_timeout end |
#hostname ⇒ Object
Returns the value of attribute hostname.
9 10 11 |
# File 'lib/hypertube-ruby-sdk/utils/ws_connection_data.rb', line 9 def hostname @hostname end |
Instance Method Details
#connection_type ⇒ Object
17 18 19 |
# File 'lib/hypertube-ruby-sdk/utils/ws_connection_data.rb', line 17 def connection_type Hypertube::Utils::ConnectionType::WEB_SOCKET end |
#serialize_connection_data ⇒ Object
21 22 23 |
# File 'lib/hypertube-ruby-sdk/utils/ws_connection_data.rb', line 21 def serialize_connection_data [connection_type, 0, 0, 0, 0, 0, 0] end |
#to_canonical_key ⇒ Object
29 30 31 32 33 34 |
# File 'lib/hypertube-ruby-sdk/utils/ws_connection_data.rb', line 29 def to_canonical_key headers_for_key = serialize_headers_for_key return to_s if headers_for_key.empty? "#{to_s}|h:#{headers_for_key}" end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/hypertube-ruby-sdk/utils/ws_connection_data.rb', line 25 def to_s "websocket|#{@hostname}" end |