Class: WebSocket::Handshake::Server
- Defined in:
- lib/websocket/handshake/server.rb
Overview
Construct or parse a server WebSocket handshake.
Instance Attribute Summary
Attributes inherited from Base
#error, #path, #query, #secure, #state, #version
Instance Method Summary collapse
-
#<<(data) ⇒ Object
Add text of request from Client.
-
#host ⇒ String
Host of server according to client header.
-
#initialize(args = {}) ⇒ Server
constructor
Initialize new WebSocket Server.
-
#port ⇒ String
Port of server according to client header.
-
#should_respond? ⇒ Boolean
Should send content to client after finished parsing?.
Methods inherited from Base
#finished?, #inspect, #leftovers, #to_s, #uri, #valid?
Constructor Details
#initialize(args = {}) ⇒ Server
Initialize new WebSocket Server
42 43 44 45 |
# File 'lib/websocket/handshake/server.rb', line 42 def initialize(args = {}) super @secure = !!args[:secure] end |
Instance Method Details
#<<(data) ⇒ Object
Add text of request from Client. This method will parse content immediately and update version, state and error(if neccessary)
62 63 64 65 66 67 |
# File 'lib/websocket/handshake/server.rb', line 62 def <<(data) @data << data if parse_data set_version end end |
#host ⇒ String
Host of server according to client header
77 78 79 |
# File 'lib/websocket/handshake/server.rb', line 77 def host @headers["host"].to_s.split(":")[0].to_s end |
#port ⇒ String
Port of server according to client header
83 84 85 |
# File 'lib/websocket/handshake/server.rb', line 83 def port @headers["host"].to_s.split(":")[1] end |
#should_respond? ⇒ Boolean
Should send content to client after finished parsing?
71 72 73 |
# File 'lib/websocket/handshake/server.rb', line 71 def should_respond? true end |