Compare commits

..

2 Commits

Author SHA1 Message Date
9a23960d21 1.2.8 2021-02-01 22:36:38 +00:00
23cca6cce3 fix(core): update 2021-02-01 22:36:37 +00:00
4 changed files with 9 additions and 2 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartsocket",
"version": "1.2.7",
"version": "1.2.8",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartsocket",
"version": "1.2.7",
"version": "1.2.8",
"description": "easy and secure websocket communication",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",

View File

@ -124,6 +124,12 @@ export class Smartsocket {
});
logger.log('info', 'Socket connected. Trying to authenticate...');
this.socketConnections.add(socketConnection);
const disconnectSubscription = socketConnection.eventSubject.subscribe((eventArg) => {
if (eventArg === 'disconnected') {
this.socketConnections.remove(socketConnection);
disconnectSubscription.unsubscribe();
}
})
await socketConnection.authenticate();
await socketConnection.listenToFunctionRequests();
}

View File

@ -83,6 +83,7 @@ export class SocketConnection {
);
await this.disconnect();
allSocketConnections.remove(this);
this.eventSubject.next('disconnected');
});
}