Class: RubyAsterisk::ARI::WebSocket::SocketAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-asterisk/ari/websocket/socket_adapter.rb

Overview

Minimal socket wrapper handed to WebSocket::Driver.client: the driver reads #url to build the handshake request (including Basic auth from the URL userinfo) and calls #write to emit outgoing bytes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, io) ⇒ SocketAdapter

Returns a new instance of SocketAdapter.



12
13
14
15
# File 'lib/ruby-asterisk/ari/websocket/socket_adapter.rb', line 12

def initialize(url, io)
  @url = url
  @io = io
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



10
11
12
# File 'lib/ruby-asterisk/ari/websocket/socket_adapter.rb', line 10

def url
  @url
end

Instance Method Details

#write(data) ⇒ Object



17
18
19
# File 'lib/ruby-asterisk/ari/websocket/socket_adapter.rb', line 17

def write(data)
  @io.write(data)
end