Compare commits

..

4 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
2a9e58cc35 1.2.7 2021-01-28 12:39:32 +00:00
7d6a9921b5 fix(core): update 2021-01-28 12:39:31 +00:00
4 changed files with 14 additions and 11 deletions

8
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartsocket", "name": "@pushrocks/smartsocket",
"version": "1.2.6", "version": "1.2.8",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -1567,9 +1567,9 @@
} }
}, },
"@pushrocks/smartjson": { "@pushrocks/smartjson": {
"version": "4.0.5", "version": "4.0.6",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartjson/-/smartjson-4.0.5.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartjson/-/smartjson-4.0.6.tgz",
"integrity": "sha512-i4kBjZSbs1t8swcAPEdPkDJHci2higzvMIkNUKTgXWrcxUFMuOis/B5huUnnIqg/Td8R+mAdf/B/CMfgjABTlg==", "integrity": "sha512-lykr068RSDHs0+EXCvIDVxjKnDtRQ2M7EXOo5jVrUU6/OEdfRl9ErM1K/oPafiEi47/PtTrwLlp1KdSgqkRjmg==",
"requires": { "requires": {
"@types/buffer-json": "^2.0.0", "@types/buffer-json": "^2.0.0",
"@types/fast-json-stable-stringify": "^2.0.0", "@types/fast-json-stable-stringify": "^2.0.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartsocket", "name": "@pushrocks/smartsocket",
"version": "1.2.6", "version": "1.2.8",
"description": "easy and secure websocket communication", "description": "easy and secure websocket communication",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
@ -26,7 +26,7 @@
"@pushrocks/smartdelay": "^2.0.10", "@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartenv": "^4.0.16", "@pushrocks/smartenv": "^4.0.16",
"@pushrocks/smartexpress": "^3.0.100", "@pushrocks/smartexpress": "^3.0.100",
"@pushrocks/smartjson": "^4.0.5", "@pushrocks/smartjson": "^4.0.6",
"@pushrocks/smartlog": "^2.0.39", "@pushrocks/smartlog": "^2.0.39",
"@pushrocks/smartpromise": "^3.1.3", "@pushrocks/smartpromise": "^3.1.3",
"@pushrocks/smartrx": "^2.0.19", "@pushrocks/smartrx": "^2.0.19",

View File

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

View File

@ -83,6 +83,7 @@ export class SocketConnection {
); );
await this.disconnect(); await this.disconnect();
allSocketConnections.remove(this); allSocketConnections.remove(this);
this.eventSubject.next('disconnected');
}); });
} }
@ -192,11 +193,7 @@ export class SocketConnection {
}); });
this.socket.on('updateTagStore', async (tagStoreArg: interfaces.TTagStore) => { this.socket.on('updateTagStore', async (tagStoreArg: interfaces.TTagStore) => {
const exitingStoreString = plugins.smartjson.stringify(this.tagStore); if (!plugins.smartjson.deepEqualObjects(this.tagStore, tagStoreArg)) {
const newStoreString = plugins.smartjson.stringify(tagStoreArg);
console.log(exitingStoreString);
console.log(newStoreString);
if (exitingStoreString !== newStoreString) {
this.tagStore = tagStoreArg; this.tagStore = tagStoreArg;
this.socket.emit('updateTagStore', this.tagStore); this.socket.emit('updateTagStore', this.tagStore);
this.tagStoreObservable.next(this.tagStore); this.tagStoreObservable.next(this.tagStore);