Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 12d7310b90 | |||
| 9fc4db1e35 | |||
| 895464115e | |||
| 00f22f9651 |
13
.snyk
13
.snyk
@@ -1,13 +0,0 @@
|
|||||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
|
||||||
version: v1.13.5
|
|
||||||
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
|
|
||||||
ignore:
|
|
||||||
SNYK-JS-JSYAML-173999:
|
|
||||||
- '@pushrocks/smartexpress > @pushrocks/smartfile > js-yaml':
|
|
||||||
reason: None given
|
|
||||||
expires: '2019-05-24T15:16:11.291Z'
|
|
||||||
SNYK-JS-JSYAML-174129:
|
|
||||||
- '@pushrocks/smartexpress > @pushrocks/smartfile > js-yaml':
|
|
||||||
reason: None given
|
|
||||||
expires: '2019-05-24T15:16:11.291Z'
|
|
||||||
patch: {}
|
|
||||||
3625
package-lock.json
generated
3625
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartsocket",
|
"name": "@pushrocks/smartsocket",
|
||||||
"version": "1.2.13",
|
"version": "1.2.15",
|
||||||
"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",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild --web && tsbundle --from ./ts/index.ts --to dist_bundle/bundle.js)"
|
"build": "tsbuild --web --skiplibcheck",
|
||||||
|
"buildswitch": "(tsbuild --web && tsbundle --from ./ts/index.ts --to dist_bundle/bundle.js)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||||
"@pushrocks/isohash": "^1.0.2",
|
"@pushrocks/isohash": "^1.0.2",
|
||||||
"@pushrocks/isounique": "^1.0.4",
|
"@pushrocks/isounique": "^1.0.5",
|
||||||
"@pushrocks/lik": "^5.0.0",
|
"@pushrocks/lik": "^5.0.0",
|
||||||
"@pushrocks/smartdelay": "^2.0.13",
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
"@pushrocks/smartenv": "^4.0.16",
|
"@pushrocks/smartenv": "^4.0.16",
|
||||||
@@ -31,17 +32,15 @@
|
|||||||
"@pushrocks/smartpromise": "^3.1.6",
|
"@pushrocks/smartpromise": "^3.1.6",
|
||||||
"@pushrocks/smartrx": "^2.0.19",
|
"@pushrocks/smartrx": "^2.0.19",
|
||||||
"@pushrocks/smarttime": "^3.0.43",
|
"@pushrocks/smarttime": "^3.0.43",
|
||||||
"@types/socket.io": "^3.0.2",
|
"socket.io": "^4.4.1",
|
||||||
"@types/socket.io-client": "^3.0.0",
|
"socket.io-client": "^4.4.1"
|
||||||
"socket.io": "^3.1.0",
|
|
||||||
"socket.io-client": "^3.1.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.28",
|
"@gitzone/tsbuild": "^2.1.29",
|
||||||
"@gitzone/tsrun": "^1.2.18",
|
"@gitzone/tsrun": "^1.2.18",
|
||||||
"@gitzone/tstest": "^1.0.60",
|
"@gitzone/tstest": "^1.0.60",
|
||||||
"@pushrocks/tapbundle": "^3.2.15",
|
"@pushrocks/tapbundle": "^3.2.15",
|
||||||
"@types/node": "^17.0.9",
|
"@types/node": "^17.0.10",
|
||||||
"tslint": "^6.1.3",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export class Smartsocket {
|
|||||||
/**
|
/**
|
||||||
* the standard handler for new socket connections
|
* the standard handler for new socket connections
|
||||||
*/
|
*/
|
||||||
private async _handleSocketConnection(socketArg: SocketIO.Socket) {
|
private async _handleSocketConnection(socketArg: pluginsTyped.socketIo.Socket) {
|
||||||
const socketConnection: SocketConnection = new SocketConnection({
|
const socketConnection: SocketConnection = new SocketConnection({
|
||||||
alias: undefined,
|
alias: undefined,
|
||||||
authenticated: false,
|
authenticated: false,
|
||||||
|
|||||||
@@ -91,13 +91,7 @@ export class SmartsocketClient {
|
|||||||
public async connect() {
|
public async connect() {
|
||||||
const done = plugins.smartpromise.defer();
|
const done = plugins.smartpromise.defer();
|
||||||
const smartenvInstance = new plugins.smartenv.Smartenv();
|
const smartenvInstance = new plugins.smartenv.Smartenv();
|
||||||
const socketIoClient = await smartenvInstance.getEnvAwareModule({
|
const socketIoClient = plugins.socketIoClient;
|
||||||
nodeModuleName: 'socket.io-client',
|
|
||||||
webUrlArg: 'https://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js',
|
|
||||||
getFunction: () => {
|
|
||||||
return globalThis.io;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
logger.log('info', 'trying to connect...');
|
logger.log('info', 'trying to connect...');
|
||||||
const socketUrl = `${this.serverUrl}:${this.serverPort}`;
|
const socketUrl = `${this.serverUrl}:${this.serverPort}`;
|
||||||
this.socketConnection = new SocketConnection({
|
this.socketConnection = new SocketConnection({
|
||||||
@@ -122,13 +116,13 @@ export class SmartsocketClient {
|
|||||||
// authentication flow
|
// authentication flow
|
||||||
this.socketConnection.socket.on(
|
this.socketConnection.socket.on(
|
||||||
'requestAuth',
|
'requestAuth',
|
||||||
(requestAuthPayload: interfaces.IRequestAuthPayload) => {
|
(dataArg: interfaces.IRequestAuthPayload) => {
|
||||||
timer.reset();
|
timer.reset();
|
||||||
logger.log('info', 'server requested authentication');
|
logger.log('info', `server ${dataArg.serverAlias} requested authentication`);
|
||||||
|
|
||||||
// lets register the authenticated event
|
// lets register the authenticated event
|
||||||
this.socketConnection.socket.on('authenticated', async () => {
|
this.socketConnection.socket.on('authenticated', async () => {
|
||||||
this.remoteShortId = requestAuthPayload.serverAlias;
|
this.remoteShortId = dataArg.serverAlias;
|
||||||
logger.log('info', 'client is authenticated');
|
logger.log('info', 'client is authenticated');
|
||||||
this.socketConnection.authenticated = true;
|
this.socketConnection.authenticated = true;
|
||||||
await this.socketConnection.listenToFunctionRequests();
|
await this.socketConnection.listenToFunctionRequests();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import * as plugins from './smartsocket.plugins';
|
import * as plugins from './smartsocket.plugins';
|
||||||
|
import * as pluginsTyped from './smartsocket.pluginstyped';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
// import classes
|
// import classes
|
||||||
@@ -7,7 +8,6 @@ import { SocketFunction } from './smartsocket.classes.socketfunction';
|
|||||||
import { SocketRequest, ISocketRequestDataObject } from './smartsocket.classes.socketrequest';
|
import { SocketRequest, ISocketRequestDataObject } from './smartsocket.classes.socketrequest';
|
||||||
|
|
||||||
// socket.io
|
// socket.io
|
||||||
import * as pluginsTyped from './smartsocket.pluginstyped';
|
|
||||||
import { SmartsocketClient } from './smartsocket.classes.smartsocketclient';
|
import { SmartsocketClient } from './smartsocket.classes.smartsocketclient';
|
||||||
import { logger } from './smartsocket.logging';
|
import { logger } from './smartsocket.logging';
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ export interface ISocketConnectionConstructorOptions {
|
|||||||
authenticated: boolean;
|
authenticated: boolean;
|
||||||
side: TSocketConnectionSide;
|
side: TSocketConnectionSide;
|
||||||
smartsocketHost: Smartsocket | SmartsocketClient;
|
smartsocketHost: Smartsocket | SmartsocketClient;
|
||||||
socket: SocketIO.Socket | SocketIOClient.Socket;
|
socket: pluginsTyped.socketIo.Socket | plugins.socketIoClient.Socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +47,7 @@ export class SocketConnection {
|
|||||||
public side: TSocketConnectionSide;
|
public side: TSocketConnectionSide;
|
||||||
public authenticated: boolean = false;
|
public authenticated: boolean = false;
|
||||||
public smartsocketRef: Smartsocket | SmartsocketClient;
|
public smartsocketRef: Smartsocket | SmartsocketClient;
|
||||||
public socket: SocketIO.Socket | SocketIOClient.Socket;
|
public socket: pluginsTyped.socketIo.Socket | plugins.socketIoClient.Socket;
|
||||||
|
|
||||||
public eventSubject = new plugins.smartrx.rxjs.Subject<interfaces.TConnectionStatus>();
|
public eventSubject = new plugins.smartrx.rxjs.Subject<interfaces.TConnectionStatus>();
|
||||||
public eventStatus: interfaces.TConnectionStatus = 'new';
|
public eventStatus: interfaces.TConnectionStatus = 'new';
|
||||||
|
|||||||
@@ -27,3 +27,9 @@ export {
|
|||||||
smarttime,
|
smarttime,
|
||||||
smartrx,
|
smartrx,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// thirdparty
|
||||||
|
import * as socketIoClient from 'socket.io-client';
|
||||||
|
export {
|
||||||
|
socketIoClient
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user