class WebSocket::Handshake::Handler::Server75

Private Instance Methods

handshake_keys() click to toggle source

@see WebSocket::Handshake::Handler::Base#handshake_keys

# File lib/websocket/handshake/handler/server75.rb, line 23
def handshake_keys
  [
    %w[Upgrade WebSocket],
    %w[Connection Upgrade],
    [headers[:origin], @handshake.headers['origin']],
    [headers[:location], @handshake.uri]
  ] + protocol
end
header_line() click to toggle source

@see WebSocket::Handshake::Handler::Base#header_line

# File lib/websocket/handshake/handler/server75.rb, line 18
def header_line
  'HTTP/1.1 101 Web Socket Protocol Handshake'
end
headers() click to toggle source
# File lib/websocket/handshake/handler/server75.rb, line 9
def headers
  {
    origin: 'WebSocket-Origin',
    location: 'WebSocket-Location',
    protocol: 'WebSocket-Protocol'
  }.freeze
end
protocol() click to toggle source
# File lib/websocket/handshake/handler/server75.rb, line 32
def protocol
  return [] unless @handshake.headers.key?(headers[:protocol].downcase)
  proto = @handshake.headers[headers[:protocol].downcase]
  [[headers[:protocol], @handshake.protocols.include?(proto) ? proto : nil]]
end