Class: WebSocket::Handshake::Client
- Defined in:
- lib/websocket/handshake/client.rb
Overview
Construct or parse a client WebSocket handshake.
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
Attributes inherited from Base
#host, #path, #protocols, #query, #secure, #state, #version
Attributes included from ExceptionHandler
Instance Method Summary collapse
-
#<<(data) ⇒ Object
Add text of response from Server.
-
#initialize(args = {}) ⇒ Client
constructor
Initialize new WebSocket Client.
-
#should_respond? ⇒ Boolean
Should send content to server after finished parsing?.
Methods inherited from Base
#default_port, #default_port?, #finished?, #leftovers, #port, #to_s, #uri, #valid?
Methods included from NiceInspect
Methods included from ExceptionHandler
Constructor Details
#initialize(args = {}) ⇒ Client
Initialize new WebSocket Client
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/websocket/handshake/client.rb', line 57 def initialize(args = {}) super if @url || @uri uri = URI.parse(@url || @uri) @secure ||= (uri.scheme == 'wss') @host ||= uri.host @port ||= uri.port || default_port @path ||= uri.path @query ||= uri.query end @path = '/' if @path.nil? || @path.empty? @version ||= DEFAULT_VERSION raise WebSocket::Error::Handshake::NoHostProvided unless @host include_version end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
37 38 39 |
# File 'lib/websocket/handshake/client.rb', line 37 def headers @headers end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
37 38 39 |
# File 'lib/websocket/handshake/client.rb', line 37 def origin @origin end |
Instance Method Details
#<<(data) ⇒ Object
Add text of response from Server. This method will parse content immediately and update state and error(if neccessary)
90 91 92 93 |
# File 'lib/websocket/handshake/client.rb', line 90 def <<(data) super parse_data end |
#should_respond? ⇒ Boolean
Should send content to server after finished parsing?
98 99 100 |
# File 'lib/websocket/handshake/client.rb', line 98 def should_respond? false end |