How to redirect to the webform node when it just created? I followed the webform cookbook and created a custom module to "automatically create a Webform node when adding a Webform". Moreover, I need to redirect to the Webform Node at the same time, so I add the "RedirectResponse" code, but it didn't work. Following is my code:

function webform_chshb_webform_insert(\Drupal\webform\WebformInterface $webform) {
    $webformnode = \Drupal\node\entity\Node::create([
        'type' =&gt; 'webform',
        'title' =&gt; $webform-&gt;label(),
        'webform' =&gt; ['target_id' =&gt; $webform-&gt;id()],
    ]);
    $webformnode-&gt;save();
    drupal_set_message(t('Node %label created.', ['%label' =&gt; $webformnode-&gt;label()]));

    $nodeid = $webformnode-&gt;id();
    $response = new RedirectResponse("/node/$nodeid/edit");
    $response-&gt;send();
}


Thank you.
try it with return 

function webform_chshb_webform_insert(\Drupal\webform\WebformInterface $webform) {
    $webformnode = \Drupal\node\entity\Node::create([
        'type' =&gt; 'webform',
        'title' =&gt; $webform-&gt;label(),
        'webform' =&gt; ['target_id' =&gt; $webform-&gt;id()],
    ]);
    $webformnode-&gt;save();
    drupal_set_message(t('Node %label created.', ['%label' =&gt; $webformnode-&gt;label()]));

    $nodeid = $webformnode-&gt;id();
    $response = new RedirectResponse("/node/$nodeid/edit");
    $response-&gt;send();
    return;
}