EventSubscriber called on specific node type or path
I managed to do it but I feel it could be done much better.

class eSubscriber implements EventSubscriberInterface {

  public static function getSubscribedEvents() {
    $events[KernelEvents::TERMINATE][] = ['onRespond',27];
    return $events;
  }

  public function onRespond(PostResponseEvent $event) {
    $node = \Drupal::routeMatch()-&gt;getParameter('node');
    $user = \Drupal::currentUser();
    $name = $user-&gt;getUsername();

    $output = [];
    if (isset($node) &amp;&amp; isset($name)) {

      $nodeType = $node-&gt;getType();
      $soap_response = new classThatHandleRequests();
      $output = $soap_response -&gt; get_clients_fv($name);
      echo('&lt;script&gt;var JSONarray = ' . print_r($output,1) . ';&lt;/script&gt;');
    }
  }
}