Class: Ronin::Support::Web::WebSocket::Client
- Includes:
- URLMethods
- Defined in:
- lib/ronin/support/web/websocket/client.rb
Overview
Represents a WebSocket client.
Instance Attribute Summary
Attributes included from URLMethods
Attributes inherited from Socket
Instance Method Summary collapse
-
#initialize(url, ssl: {}, **kwargs) ⇒ Client
constructor
Initializes the WebSocket client.
Methods included from URLMethods
Methods inherited from Socket
#close, #closed?, #handshake_finished?, #handshake_valid?, #recv, #recv_frame, #send, #send_frame
Constructor Details
#initialize(url, ssl: {}, **kwargs) ⇒ Client
Initializes the WebSocket client.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/ronin/support/web/websocket/client.rb', line 86 def initialize(url, ssl: {}, **kwargs) super(url) @socket = case @url.scheme when 'ws' Support::Network::TCP.connect( @host, @port, **kwargs ) when 'wss' Support::Network::SSL.connect( @host, @port, **kwargs, **ssl ) else raise(ArgumentError,"unsupported websocket scheme: #{url}") end send_handshake! set_frame_classes( ::WebSocket::Frame::Incoming::Client, ::WebSocket::Frame::Outgoing::Client ) end |