class WebSocket::Driver::Hybi

def shutdown(code, reason, error = false)

def shutdown(code, reason, error = false)
  @frame = @message = nil
  @stage = 5
  @extensions.close
  frame(reason, :close, code) if @ready_state < 2
  @ready_state = 3
  emit(:error, ProtocolError.new(reason)) if error
  emit(:close, CloseEvent.new(code, reason))
end