class WebSocket::Driver::Hybi

def initialize(socket, options = {})

def initialize(socket, options = {})
  super
  @extensions      = ::WebSocket::Extensions.new
  @stage           = 0
  @masking         = options[:masking]
  @protocols       = options[:protocols] || []
  @protocols       = @protocols.strip.split(/ *, */) if String === @protocols
  @require_masking = options[:require_masking]
  @ping_callbacks  = {}
  @frame = @message = nil
  return unless @socket.respond_to?(:env)
  if protos = @socket.env['HTTP_SEC_WEBSOCKET_PROTOCOL']
    protos = protos.split(/ *, */) if String === protos
    @protocol = protos.find { |p| @protocols.include?(p) }
  else
    @protocol = nil
  end
end