How to notify the user from a Task Is it possible to somehow notify the user from a completing task?
I am walking trough a set of .csv files and on completion i would like to notify the user.

// last step
$stepIndex = $step + 1;
if ( $stepIndex == $this-&gt;getTotalSteps() )
{
    craft()-&gt;userSession-&gt;getFlash('notice', 'Reroutes  imported.');
    // craft()-&gt;userSession-&gt;setNotice(Craft::t('Reroutes   imported.'));
    // craft()-&gt;userSession-&gt;getFlashes();
}

return true;


I tried with the UserSessionService but i guess that won't work because the task is running separately from the session. If so reloading the page would be a good alternative but how can I let the front-end know of the task being completed.
The simple way to do this would be to log a message to your Plugin's custom log using

ExamplePlugin::log( 'TaskName has completed' );

This would require the user to visit the log and refresh to see if the task had completed - not ideal!

However, if you wanted something that updated as the task was being run you could possibly redirect them to a Plugin template with a text area that  displays a log for the task where you could show completion of each step of the task and then finally a "Completed Task" message.

// Create task
$task = craft()-&gt;tasks-&gt;createTask( 'TaskName', 'desc' ), array(
  'products' =&gt; $products
));

// Set session notice for start
craft()-&gt;userSession-&gt;setNotice(Craft::t('Import process started.'));

// Redirect to Plugin template page that displays a log
$this-&gt;redirect( 'templateName?task=' . $task-&gt;id );


Then inside the task you could log messages to be displayed in that template

if($step === $this-&gt;getTotalSteps()-1) {
  Log::message( 'Task finished.' );
}