WebSocket::Frame::Outgoing

Construct or parse incoming WebSocket Frame. @note You should NEVER use this class directly - use Client or Server subclasses instead, as they contain additional frame options(i.e. Client-side masking in draft 04)

@example

frame = WebSocket::Frame::Outgoing::Server.new(:version => @handshake.version, :data => "Hello", :type => :text)
frame.to_s # "\x81\x05\x48\x65\x6c\x6c\x6f"

Public Instance Methods

require_sending?() click to toggle source

Should current frame be sent? Exclude empty frames etc. @return [Boolean] true if frame should be sent

# File lib/websocket/frame/outgoing.rb, line 22
def require_sending?
  !error?
end
supported?() click to toggle source

Is selected type supported by current draft version? @return [Boolean] true if frame type is supported

# File lib/websocket/frame/outgoing.rb, line 16
def supported?
  support_type?
end
to_s() click to toggle source

Return raw frame formatted for sending.

# File lib/websocket/frame/outgoing.rb, line 27
def to_s
  set_error(:unknown_frame_type) and return unless supported?
  encode_frame
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.