Class: Kosmonaut::Socket

Inherits:
Object
  • Object
show all
Defined in:
lib/kosmonaut/socket.rb

Overview

Internal: Socket is a base class defining tools and helpers used by Client and Worker implementations.

Direct Known Subclasses

Client, Worker

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Socket

Internal: The Socket constructor.

The endpoint’s URL must have the following format:

[scheme]://[secret]@[host]:[port]/[vhost]


28
29
30
31
# File 'lib/kosmonaut/socket.rb', line 28

def initialize(url)
  @uri = URI.parse(url)
  @addr = ::Socket.getaddrinfo(@uri.host, nil)
end

Instance Attribute Details

#uriObject (readonly)

Public: A parsed URL of the WebRocket backend endpoint.



20
21
22
# File 'lib/kosmonaut/socket.rb', line 20

def uri
  @uri
end