Module: Ronin::Support::Web::WebSocket::URLMethods Private

Included in:
Client, Server
Defined in:
lib/ronin/support/web/websocket/url_methods.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Mixin which accepts and parses a ws:// or wss:// URL.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostString (readonly)

The websocket host name.

Returns:

  • (String)


45
46
47
# File 'lib/ronin/support/web/websocket/url_methods.rb', line 45

def host
  @host
end

#pathString (readonly)

The websocket port.

Returns:

  • (String)


59
60
61
# File 'lib/ronin/support/web/websocket/url_methods.rb', line 59

def path
  @path
end

#portInteger (readonly)

The websocket port.

Returns:

  • (Integer)


52
53
54
# File 'lib/ronin/support/web/websocket/url_methods.rb', line 52

def port
  @port
end

#urlURI::WS, URI::WSS (readonly)

The parsed ws:// or wss:// URI.

Returns:

  • (URI::WS, URI::WSS)


38
39
40
# File 'lib/ronin/support/web/websocket/url_methods.rb', line 38

def url
  @url
end

Instance Method Details

#initialize(url) ⇒ Object

Sets the #url.

Parameters:

  • url (String)

    The ws:// or wss:// URL.



69
70
71
72
73
74
75
# File 'lib/ronin/support/web/websocket/url_methods.rb', line 69

def initialize(url)
  @url  = URI(url)
  @host = @url.host
  @port = @url.port
  @path = @url.path
  @ssl  = (@url.scheme == 'wss')
end

#ssl?Boolean

Determines whether the websocket uses SSL/TLS.

Returns:

  • (Boolean)


84
85
86
# File 'lib/ronin/support/web/websocket/url_methods.rb', line 84

def ssl?
  @ssl
end