lib/websocket_parser.rb
def frame_format(payload_length, masked = false)
    format = 'CC'

    if payload_length > 65_535
      format += 'Q>'
    elsif payload_length > 125
      format += 'n'
    end

    if masked
      format += 'a4'
    end

    if payload_length > 0
      format += "a#{payload_length}"
    end

    format
  end
# Determines how to unpack the frame depending on
# the payload length and wether the frame is masked
Determines how to unpack the frame depending on
the payload length and wether the frame is masked
Determines how to unpack the frame depending on the payload length and wether the frame is masked
def frame_format(payload_length, masked = false)
    format = 'CC'
    if payload_length > 65_535
      format += 'Q>'
    elsif payload_length > 125
      format += 'n'
    end
    if masked
      format += 'a4'
    end
    if payload_length > 0
      format += "a#{payload_length}"
    end
    format
  end
def frame_format ( payload_length , masked = false ) format = 'CC' if payload_length > 65_535 format += 'Q>' elsif payload_length > 125 format += 'n' end if masked format += 'a4' end if payload_length > 0 format += "a#{payload_length}" end format end
Determines how to unpack the frame depending on
the payload length and wether the frame is masked
Determines how to unpack the frame depending on the payload length and wether the frame is masked
payload_length
masked