Compare commits

..

4 Commits

Author SHA1 Message Date
12d7310b90 1.2.15 2022-01-19 18:06:41 +01:00
9fc4db1e35 fix(core): update 2022-01-19 18:06:39 +01:00
895464115e 1.2.14 2022-01-19 16:37:46 +01:00
00f22f9651 fix(core): update 2022-01-19 16:37:45 +01:00
7 changed files with 1825 additions and 1858 deletions

13
.snyk
View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,13 @@
{
"name": "@pushrocks/smartsocket",
"version": "1.2.13",
"version": "1.2.15",
"description": "easy and secure websocket communication",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"scripts": {
"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": {
"type": "git",
@@ -21,7 +22,7 @@
"dependencies": {
"@apiglobal/typedrequest-interfaces": "^1.0.15",
"@pushrocks/isohash": "^1.0.2",
"@pushrocks/isounique": "^1.0.4",
"@pushrocks/isounique": "^1.0.5",
"@pushrocks/lik": "^5.0.0",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^4.0.16",
@@ -31,17 +32,15 @@
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrx": "^2.0.19",
"@pushrocks/smarttime": "^3.0.43",
"@types/socket.io": "^3.0.2",
"@types/socket.io-client": "^3.0.0",
"socket.io": "^3.1.0",
"socket.io-client": "^3.1.0"
"socket.io": "^4.4.1",
"socket.io-client": "^4.4.1"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.28",
"@gitzone/tsbuild": "^2.1.29",
"@gitzone/tsrun": "^1.2.18",
"@gitzone/tstest": "^1.0.60",
"@pushrocks/tapbundle": "^3.2.15",
"@types/node": "^17.0.9",
"@types/node": "^17.0.10",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},

View File

@@ -103,7 +103,7 @@ export class Smartsocket {
/**
* 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({
alias: undefined,
authenticated: false,

View File

@@ -91,13 +91,7 @@ export class SmartsocketClient {
public async connect() {
const done = plugins.smartpromise.defer();
const smartenvInstance = new plugins.smartenv.Smartenv();
const socketIoClient = await smartenvInstance.getEnvAwareModule({
nodeModuleName: 'socket.io-client',
webUrlArg: 'https://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js',
getFunction: () => {
return globalThis.io;
},
});
const socketIoClient = plugins.socketIoClient;
logger.log('info', 'trying to connect...');
const socketUrl = `${this.serverUrl}:${this.serverPort}`;
this.socketConnection = new SocketConnection({
@@ -122,13 +116,13 @@ export class SmartsocketClient {
// authentication flow
this.socketConnection.socket.on(
'requestAuth',
(requestAuthPayload: interfaces.IRequestAuthPayload) => {
(dataArg: interfaces.IRequestAuthPayload) => {
timer.reset();
logger.log('info', 'server requested authentication');
logger.log('info', `server ${dataArg.serverAlias} requested authentication`);
// lets register the authenticated event
this.socketConnection.socket.on('authenticated', async () => {
this.remoteShortId = requestAuthPayload.serverAlias;
this.remoteShortId = dataArg.serverAlias;
logger.log('info', 'client is authenticated');
this.socketConnection.authenticated = true;
await this.socketConnection.listenToFunctionRequests();

View File

@@ -1,4 +1,5 @@
import * as plugins from './smartsocket.plugins';
import * as pluginsTyped from './smartsocket.pluginstyped';
import * as interfaces from './interfaces';
// import classes
@@ -7,7 +8,6 @@ import { SocketFunction } from './smartsocket.classes.socketfunction';
import { SocketRequest, ISocketRequestDataObject } from './smartsocket.classes.socketrequest';
// socket.io
import * as pluginsTyped from './smartsocket.pluginstyped';
import { SmartsocketClient } from './smartsocket.classes.smartsocketclient';
import { logger } from './smartsocket.logging';
@@ -26,7 +26,7 @@ export interface ISocketConnectionConstructorOptions {
authenticated: boolean;
side: TSocketConnectionSide;
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 authenticated: boolean = false;
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 eventStatus: interfaces.TConnectionStatus = 'new';

View File

@@ -27,3 +27,9 @@ export {
smarttime,
smartrx,
};
// thirdparty
import * as socketIoClient from 'socket.io-client';
export {
socketIoClient
}