Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
20e7584eb9 | |||
59cbc343cc | |||
75aa1f6f0d | |||
3f073ab9b3 |
47
package-lock.json
generated
47
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartsocket",
|
"name": "@pushrocks/smartsocket",
|
||||||
"version": "1.1.51",
|
"version": "1.1.53",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -495,20 +495,23 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@pushrocks/smartrx": {
|
"@pushrocks/smartrx": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.5",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrx/-/smartrx-2.0.3.tgz",
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrx/-/smartrx-2.0.5.tgz",
|
||||||
"integrity": "sha512-OWxagu+CBdPaq76AIg91hJyrNhDTlEpesj01ooWCeVIaLY3G7yvFkqHsEKNOwPUG1LzCWmjq1l1dHQx9p2vJ9A==",
|
"integrity": "sha512-BOlIJmnCO8pxqu9f18D9UV5rIsyrmKeK/mWNMiAe/NH2OTeRPNLpgmhZBkXSKNVD8tSsD8aazs4BcACgYOg1FQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@pushrocks/lik": "^3.0.2",
|
"@pushrocks/lik": "^3.0.11",
|
||||||
"@pushrocks/smartevent": "^2.0.3",
|
"@pushrocks/smartevent": "^2.0.3",
|
||||||
"@pushrocks/smartpromise": "^2.0.5",
|
"@pushrocks/smartpromise": "^3.0.2",
|
||||||
"rxjs": "^6.3.3"
|
"rxjs": "^6.5.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartpromise": {
|
"rxjs": {
|
||||||
"version": "2.0.5",
|
"version": "6.5.3",
|
||||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-2.0.5.tgz",
|
"resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.5.3.tgz",
|
||||||
"integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g=="
|
"integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==",
|
||||||
|
"requires": {
|
||||||
|
"tslib": "^1.9.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -537,6 +540,17 @@
|
|||||||
"luxon": "^1.16.0"
|
"luxon": "^1.16.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@pushrocks/smartunique": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartunique/-/smartunique-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-xBu9ZB4C0BA0S/pbFFZn2ItPfnodPKpzrYIq1yN5XDs6OaookwcDF/iBwfS9+EYMSPENC9wAsOxg2RGMm4Qicw==",
|
||||||
|
"requires": {
|
||||||
|
"@types/shortid": "^0.0.29",
|
||||||
|
"@types/uuid": "^3.0.0",
|
||||||
|
"shortid": "^2.2.8",
|
||||||
|
"uuid": "^3.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@pushrocks/tapbundle": {
|
"@pushrocks/tapbundle": {
|
||||||
"version": "3.0.13",
|
"version": "3.0.13",
|
||||||
"resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.13.tgz",
|
"resolved": "https://registry.npmjs.org/@pushrocks/tapbundle/-/tapbundle-3.0.13.tgz",
|
||||||
@ -734,6 +748,14 @@
|
|||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/uuid": {
|
||||||
|
"version": "3.4.6",
|
||||||
|
"resolved": "https://verdaccio.lossless.one/@types%2fuuid/-/uuid-3.4.6.tgz",
|
||||||
|
"integrity": "sha512-cCdlC/1kGEZdEglzOieLDYBxHsvEOIg7kp/2FYyVR9Pxakq+Qf/inL3RKQ+PA8gOlI/NnL+fXmQH12nwcGzsHw==",
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/vinyl": {
|
"@types/vinyl": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://verdaccio.lossless.one/@types%2fvinyl/-/vinyl-2.0.2.tgz",
|
"resolved": "https://verdaccio.lossless.one/@types%2fvinyl/-/vinyl-2.0.2.tgz",
|
||||||
@ -2212,7 +2234,7 @@
|
|||||||
},
|
},
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
"resolved": "https://verdaccio.lossless.one/minimist/-/minimist-0.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@ -2638,6 +2660,7 @@
|
|||||||
"version": "6.3.3",
|
"version": "6.3.3",
|
||||||
"resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.3.3.tgz",
|
"resolved": "https://verdaccio.lossless.one/rxjs/-/rxjs-6.3.3.tgz",
|
||||||
"integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==",
|
"integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^1.9.0"
|
"tslib": "^1.9.0"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartsocket",
|
"name": "@pushrocks/smartsocket",
|
||||||
"version": "1.1.51",
|
"version": "1.1.53",
|
||||||
"description": "easy and secure websocket communication",
|
"description": "easy and secure websocket communication",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
@ -26,10 +26,10 @@
|
|||||||
"@pushrocks/smarthash": "^2.0.6",
|
"@pushrocks/smarthash": "^2.0.6",
|
||||||
"@pushrocks/smartlog": "^2.0.21",
|
"@pushrocks/smartlog": "^2.0.21",
|
||||||
"@pushrocks/smartpromise": "^3.0.6",
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
"@types/shortid": "0.0.29",
|
"@pushrocks/smartrx": "^2.0.5",
|
||||||
|
"@pushrocks/smartunique": "^3.0.1",
|
||||||
"@types/socket.io": "^2.1.4",
|
"@types/socket.io": "^2.1.4",
|
||||||
"@types/socket.io-client": "^1.4.32",
|
"@types/socket.io-client": "^1.4.32",
|
||||||
"shortid": "^2.2.15",
|
|
||||||
"socket.io": "^2.3.0",
|
"socket.io": "^2.3.0",
|
||||||
"socket.io-client": "^2.3.0"
|
"socket.io-client": "^2.3.0"
|
||||||
},
|
},
|
||||||
|
@ -16,6 +16,10 @@ export interface ISmartsocketConstructorOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Smartsocket {
|
export class Smartsocket {
|
||||||
|
/**
|
||||||
|
* a unique id to detect server restarts
|
||||||
|
*/
|
||||||
|
public id = plugins.smartunique.shortId();
|
||||||
public options: ISmartsocketConstructorOptions;
|
public options: ISmartsocketConstructorOptions;
|
||||||
public io: SocketIO.Server;
|
public io: SocketIO.Server;
|
||||||
public socketConnections = new Objectmap<SocketConnection>();
|
public socketConnections = new Objectmap<SocketConnection>();
|
||||||
@ -80,7 +84,7 @@ export class Smartsocket {
|
|||||||
funcName: functionNameArg
|
funcName: functionNameArg
|
||||||
},
|
},
|
||||||
originSocketConnection: targetSocketConnectionArg,
|
originSocketConnection: targetSocketConnectionArg,
|
||||||
shortId: plugins.shortid.generate(),
|
shortId: plugins.smartunique.shortId(),
|
||||||
side: 'requesting'
|
side: 'requesting'
|
||||||
});
|
});
|
||||||
const response: ISocketFunctionCallDataResponse<T> = await socketRequest.dispatch();
|
const response: ISocketFunctionCallDataResponse<T> = await socketRequest.dispatch();
|
||||||
|
@ -23,6 +23,8 @@ export class SmartsocketClient {
|
|||||||
public serverUrl: string;
|
public serverUrl: string;
|
||||||
public serverPort: number;
|
public serverPort: number;
|
||||||
|
|
||||||
|
// public eventSubject = new plugins.smart
|
||||||
|
|
||||||
public socketFunctions = new plugins.lik.Objectmap<SocketFunction<any>>();
|
public socketFunctions = new plugins.lik.Objectmap<SocketFunction<any>>();
|
||||||
public socketRequests = new plugins.lik.Objectmap<SocketRequest<any>>();
|
public socketRequests = new plugins.lik.Objectmap<SocketRequest<any>>();
|
||||||
public socketRoles = new plugins.lik.Objectmap<SocketRole>();
|
public socketRoles = new plugins.lik.Objectmap<SocketRole>();
|
||||||
@ -55,7 +57,10 @@ export class SmartsocketClient {
|
|||||||
role: this.socketRole,
|
role: this.socketRole,
|
||||||
side: 'client',
|
side: 'client',
|
||||||
smartsocketHost: this,
|
smartsocketHost: this,
|
||||||
socket: plugins.socketIoClient(socketUrl, { multiplex: false })
|
socket: plugins.socketIoClient(socketUrl, {
|
||||||
|
multiplex: false,
|
||||||
|
reconnectionAttempts: 5,
|
||||||
|
})
|
||||||
});
|
});
|
||||||
this.socketConnection.socket.on('requestAuth', () => {
|
this.socketConnection.socket.on('requestAuth', () => {
|
||||||
plugins.smartlog.defaultLogger.log('info', 'server requested authentication');
|
plugins.smartlog.defaultLogger.log('info', 'server requested authentication');
|
||||||
@ -111,7 +116,7 @@ export class SmartsocketClient {
|
|||||||
const socketRequest = new SocketRequest<T>(this, {
|
const socketRequest = new SocketRequest<T>(this, {
|
||||||
side: 'requesting',
|
side: 'requesting',
|
||||||
originSocketConnection: this.socketConnection,
|
originSocketConnection: this.socketConnection,
|
||||||
shortId: plugins.shortid.generate(),
|
shortId: plugins.smartunique.shortId(),
|
||||||
funcCallData: {
|
funcCallData: {
|
||||||
funcName: functionNameArg,
|
funcName: functionNameArg,
|
||||||
funcDataArg: dataArg
|
funcDataArg: dataArg
|
||||||
|
@ -10,6 +10,7 @@ import * as smarthash from '@pushrocks/smarthash';
|
|||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@pushrocks/smartdelay';
|
||||||
import * as smartexpress from '@pushrocks/smartexpress';
|
import * as smartexpress from '@pushrocks/smartexpress';
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
import * as smartunique from '@pushrocks/smartunique';
|
||||||
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@ -18,16 +19,15 @@ export {
|
|||||||
smarthash,
|
smarthash,
|
||||||
smartdelay,
|
smartdelay,
|
||||||
smartexpress,
|
smartexpress,
|
||||||
smartpromise
|
smartpromise,
|
||||||
|
smartunique,
|
||||||
};
|
};
|
||||||
|
|
||||||
// third party scope
|
// third party scope
|
||||||
import * as shortid from 'shortid';
|
|
||||||
import socketIo from 'socket.io';
|
import socketIo from 'socket.io';
|
||||||
import socketIoClient from 'socket.io-client';
|
import socketIoClient from 'socket.io-client';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
shortid,
|
|
||||||
socketIo,
|
socketIo,
|
||||||
socketIoClient
|
socketIoClient
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user