Method: OpenC3::WebSocketClientStream#initialize
- Defined in:
- lib/openc3/streams/web_socket_client_stream.rb
#initialize(url, write_timeout, read_timeout, connect_timeout = 5.0) ⇒ WebSocketClientStream
Returns a new instance of WebSocketClientStream.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/openc3/streams/web_socket_client_stream.rb', line 34 def initialize(url, write_timeout, read_timeout, connect_timeout = 5.0) @url = url @uri = URI.parse @url port = ((@uri.scheme == 'wss' or @uri.scheme == 'https') ? 443 : 80) port = @uri.port if @uri.port super(@uri.host, port, port, write_timeout, read_timeout, connect_timeout) if ['https', 'wss'].include? @uri.scheme socket = ::OpenSSL::SSL::SSLSocket.new(@write_socket) socket.sync_close = true socket.hostname = @uri.host @write_socket = socket @read_socket = socket end @headers = {} end |