title: How to fix Pending XHR Requests made after a websocket was opened?
body: <p>I am developing a Application which uses Electron with Angular as Frontend and node/express as Backend. For realtime Updates i use websocket connections, anything else is JSON Api with HTTP Calls on the Same Server Socket.</p>
  
  <p>When i open my APP, it establishes a websocket connection and can access HTTP Calls afterwards, but sometimes the HTTP Requests just keep in pending state, because they use the same connection ID as the websocket connection.</p>
  
  <p>I can not post images, so only have a link to DevTools Network Output:
  (<a href="https://www.3dmedium.de/wp-content/uploads/2019/10/network.jpg" rel="nofollow noreferrer">https://www.3dmedium.de/wp-content/uploads/2019/10/network.jpg</a>)</p>
  
  <p>the connection "websocket" is to an other Port
  the connection "localhost" is websocket to localhost:8080
  the get_chip is a http-client call to localhost:8080/get_chip</p>
  
  <p>the <code>get_chip calls</code> which are working are the ones testing <code>AllowOrigin</code>... "preflight"</p>
  
  <p>sometimes after a websocket reconnect (still ConnectionID 0) the http client calls use a other ID and are then working.</p>
  
  <p><strong>electron is in Version 4.2.2</strong></p>
  
  <p><strong>angular is in version 8.2.2</strong></p>
  
  <p><strong>The Angular Service uses:</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>import { Injectable } from '@angular/core';
  import { HttpClientModule, HttpClient } from "@angular/common/http";
  
  .....
  
  constructor(private http: HttpClient ) {
  this.wsConn = new WebSocket('ws://localhost:8080', ['soap', 'xmpp']);
  }
  
  ....
  
  
  this.http.post('http://localhost:8080/get_chip', data ).toPromise().then((result) =&gt; {
       console.log(result);
  });
  
  
  </code></pre>
  
  <p>I think it has nothing to do with the Server side.... but thats the essential initialization code:</p>
  
  <pre class="lang-js prettyprint-override"><code>import * as express from "express";
  import * as bodyParser from 'body-parser';
  import * as WebSocket from 'ws';
  
  const app = express();
  let server = app.listen(config.server.port);
  const wss = new WebSocket.Server({ server });
  </code></pre>
  
  <p><strong>Is there any way to force Chromium/Electron to not use a pending connection which is used by websockets?</strong></p>