Class: WebSocket::Handshake::Handler::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/websocket/handshake/handler/base.rb

Overview

This class and it’s descendants are included in client or server handshake in order to extend basic functionality

Direct Known Subclasses

Client, Server

Instance Method Summary collapse

Constructor Details

#initialize(handshake) ⇒ Base

Returns a new instance of Base.



8
9
10
# File 'lib/websocket/handshake/handler/base.rb', line 8

def initialize(handshake)
  @handshake = handshake
end

Instance Method Details

#to_sObject

See Also:



13
14
15
16
17
18
19
20
21
# 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?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/websocket/handshake/handler/base.rb', line 23

def valid?
  true
end