Search code examples
angularserveroauth-2.0hyperledger-composer

Angular application becoming unusable whenever the browser tab/window is closed


I have developed a hyperledger-composer application with an angular front-end and multi-user authentication (using GitHub) enabled.

The following scenario does not work:

The currently authenticated user closes the application by closing the current browser tab or window WITHOUT having logged out of GitHub before. Then he/she opens another tab or window and goes back to the address of the Angular application (which is: "localhost:4200").

This causes the following output in the console where the Angular Application had been started (using "npm start"):

enter image description here

This makes the application unusable. In order to stop the console from printing the above-mentioned output non-stop, control-c needs to be used to stop the process. Then the application needs to be restarted using "npm start".

Obviously, an application that becomes unusable whenever the user closes a browser tab/window is not desirable.

What's causing this behaviour? And how can I fix this?


Solution

  • In the file proxy.conf.js of your generated application, try changing the following line

    ws: true,
    

    to

    ws: false,
    

    This disables setting up a web socket connection to the rest server using the ngserve development tool proxy.