Compare commits

..

8 Commits

Author SHA1 Message Date
c0dad3a977 1.2.2 2021-01-23 05:50:02 +00:00
a921033cc4 fix(core): update 2021-01-23 05:50:02 +00:00
21e4712b04 1.2.1 2021-01-23 04:12:56 +00:00
df43bc2974 fix(core): update 2021-01-23 04:12:55 +00:00
564988185d 1.2.0 2020-12-26 18:06:23 +00:00
8442f3570f feat(SmartsocketClient): socket client can now be stopped with .stop() addiditionally to .reconnect(), which will still try to re 2020-12-26 18:06:22 +00:00
196357c878 1.1.71 2020-12-26 17:43:20 +00:00
bc187b7e41 fix(core): update 2020-12-26 17:43:19 +00:00
5 changed files with 331 additions and 604 deletions

913
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartsocket", "name": "@pushrocks/smartsocket",
"version": "1.1.70", "version": "1.2.2",
"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",

View File

@ -2,10 +2,8 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as isohash from '@pushrocks/isohash'; import * as isohash from '@pushrocks/isohash';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartexpress from '@pushrocks/smartexpress'; import * as smartexpress from '@pushrocks/smartexpress';
import socketIoClient = require('socket.io-client');
import smartsocket = require('../ts/index'); import smartsocket = require('../ts/index');
let testSmartsocket: smartsocket.Smartsocket; let testSmartsocket: smartsocket.Smartsocket;
@ -15,7 +13,7 @@ let testSocketFunction1: smartsocket.SocketFunction<any>;
let myseServer: smartexpress.Server; let myseServer: smartexpress.Server;
const testConfig = { const testConfig = {
port: 3005, port: 3000,
}; };
// class smartsocket // class smartsocket

View File

@ -1,11 +1,8 @@
// tslint:disable-next-line:no-implicit-dependencies // tslint:disable-next-line:no-implicit-dependencies
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as smarthash from '@pushrocks/smarthash';
import * as smartpromise from '@pushrocks/smartpromise';
import socketIoClient = require('socket.io-client');
import smartsocket = require('../ts/index'); import smartsocket = require('../ts/index');
import * as isohash from '@pushrocks/isohash';
let testSmartsocket: smartsocket.Smartsocket; let testSmartsocket: smartsocket.Smartsocket;
let testSmartsocketClient: smartsocket.SmartsocketClient; let testSmartsocketClient: smartsocket.SmartsocketClient;
@ -48,7 +45,7 @@ tap.test('should create a new smartsocket', async () => {
tap.test('should add a socketrole', async () => { tap.test('should add a socketrole', async () => {
testSocketRole1 = new smartsocket.SocketRole({ testSocketRole1 = new smartsocket.SocketRole({
name: 'testRole1', name: 'testRole1',
passwordHash: smarthash.sha256FromStringSync('testPassword'), passwordHash: await isohash.sha256FromString('testPassword'),
}); });
testSmartsocket.addSocketRoles([testSocketRole1]); testSmartsocket.addSocketRoles([testSocketRole1]);
}); });

View File

@ -85,6 +85,7 @@ export class SmartsocketClient {
socket: await socketIoClient.connect(socketUrl, { socket: await socketIoClient.connect(socketUrl, {
multiplex: false, multiplex: false,
reconnectionAttempts: 5, reconnectionAttempts: 5,
rejectUnauthorized: socketUrl.startsWith('https://localhost') ? false : true,
}), }),
}); });
@ -163,6 +164,14 @@ export class SmartsocketClient {
} }
} }
/**
* stops the client completely
*/
public async stop() {
this.autoReconnect = false;
await this.disconnect();
}
/** /**
* try a reconnection * try a reconnection
*/ */