Object
@abstract Subclass and override to implement custom handshakes
@abstract Add data to handshake
# File lib/websocket/handshake/base.rb, line 18 def <<(data) raise NotImplementedError end
Is parsing of data finished? @return [Boolena] True if request was completely parsed or error occured. False otherwise
# File lib/websocket/handshake/base.rb, line 37 def finished? @state == :finished || @state == :error end
Recreate inspect as to_s was overwritten
# File lib/websocket/handshake/base.rb, line 29 def inspect vars = self.instance_variables.map{|v| "#{v}=#{instance_variable_get(v).inspect}"}.join(", ") insp = "#{self.class}:0x%08x" % (self.__id__ * 2) "<#{insp} #{vars}>" end
Data left from parsing. Sometimes data that doesn't belong to handshake are added - use this method to retrieve them. @return [String] String if some data are available. Nil otherwise
# File lib/websocket/handshake/base.rb, line 54 def leftovers @leftovers.split("\n", reserved_leftover_lines + 1)[reserved_leftover_lines] end
@abstract Should send data after parsing is finished?
# File lib/websocket/handshake/base.rb, line 48 def should_respond? raise NotImplementedError end
Return textual representation of handshake request or response @return [String] text of response
# File lib/websocket/handshake/base.rb, line 24 def to_s "" end
URI of request. @return [String] Full URI with protocol @example
@handshake.uri #=> "ws://example.com/path?query=true"
# File lib/websocket/handshake/base.rb, line 62 def uri uri = secure ? "wss://" : "ws://" uri << host uri << ":#{port}" if port uri << path uri << "?#{query}" if query uri end
Generated with the Darkfish Rdoc Generator 2.