class WebSocket::Handshake::Handler::Base
This class and it's descendants are included in client or server handshake in order to extend basic functionality
Public Class Methods
new(handshake)
click to toggle source
# File lib/websocket/handshake/handler/base.rb, line 8 def initialize(handshake) @handshake = handshake end
Public Instance Methods
to_s()
click to toggle source
@see WebSocket::Handshake::Base#to_s
# File lib/websocket/handshake/handler/base.rb, line 13 def to_s result = [header_line] handshake_keys.each do |key| result << key.join(': ') end result << '' result << finishing_line result.join("\r\n") end
valid?()
click to toggle source
# File lib/websocket/handshake/handler/base.rb, line 23 def valid? true end
Private Instance Methods
finishing_line()
click to toggle source
Set data to send after headers. In most cases it will be blank data. @return [String] data
# File lib/websocket/handshake/handler/base.rb, line 43 def finishing_line '' end
handshake_keys()
click to toggle source
Set handshake headers. Provided as array because some protocol version require specific order of fields. @return [Array] List of headers as arrays [key, value]
# File lib/websocket/handshake/handler/base.rb, line 37 def handshake_keys [] end
header_line()
click to toggle source
Set first line of text representation according to specification. @return [String] First line of HTTP header
# File lib/websocket/handshake/handler/base.rb, line 31 def header_line '' end