NathanaelA / nativescript-websockets

Websockets for NativeScript
83 stars 43 forks source link

Connection still open after NS rebuild #85

Closed PhilippS93 closed 4 years ago

PhilippS93 commented 4 years ago

Hi,

I open a WS connection on app launch.

When rebuilding the project during development, that is on a file change: File change detected. Starting incremental webpack compilation...

a new connection is opened but the old one is never closed. How can I hook into this process to close the old one?

Thank you!

PhilippS93 commented 4 years ago

Update SOLVED:

I had to unsubscribe each observable e.g. in ngOnDestroy :

e.g.:

  this.userchangeGQL.subscribe({})
            .pipe(takeUntil(this._unsubscribeAll))
            .subscribe((data) => {
                console.log(" DATA", data);
            }, error => {
                console.log("SUBSCRIBE ERROR", error);
            });